How to write whole list? from System.Collections.Generic.List`1[System.String]?


#1

I have created a list, now I want to display this list in one go? That is to say without using For each loop.

Thanks


#2

Hi @MGDEL,

Please try the following code below:
String.Join(Environment.NewLine, list.Select(Function(a) String.Join("", a)))


#3

You don’t need the .Select, since List<T> already implements IEnumerable (if it wouldn’t, the Select call would actually be invalid since it’s from that interface :wink: ).
String.Join(Environment.NewLine, yourList)
will work just fine (same goes for arrays).