user1306322 user1306322 - 6 months ago 41
C# Question

Convert list of objects to string in one line

I have a list of objects that implement

. I need to convert the whole list to one string in one line. How can I do that?


Another method that may help out is string.Join, which takes a set of objects and will join them with any delimiter you want. For instance:

var combined = string.Join(", ", myObjects);

will make a string that is comma/space separated.