Represent an array in C #
6 answers
Typically, you can loop through it if it's a collection or an array. Check keywordforeach
List<Object> list = ...
foreach (Object o in list) {
Console.WriteLine(o.ToString);
}
0
a source to share
If you want to take a more LINQ approach, you can use the following:
String text = String.Join("," + Environment.NewLine, list.Select(item => item.ToString()).ToArray());
Console.WriteLine(text);
The first join parameter determines which characters should be inserted between array elements. Using .Select on a list is to get the string representation of your item in an array.
0
a source to share