There are a lot of questions/answers about conversion from generic IEnumerable to a string.
But I need a conversion from a non-generic IEnumerable to a string . The result string should be in form of
element1.ToString() + ", " + element2.ToString() + ", " + element3.ToString() + ...
Is there a shorter way than using StringBuilder and looping through the elements by MoveNext() ?
您仍然可以使用LINQ:
String.Join(", ", thingy.Cast<object>());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.