![](/img/trans.png)
[英]What is the difference between the non-generic IEnumerable and the generic IEnumerable<T>?
[英]Non-generic IEnumerable to string
關於從通用 IEnumerable到字符串的轉換有很多問題/答案。
但我需要從非通用的 IEnumerable轉換為字符串 。 結果字符串應為
element1.ToString() + ", " + element2.ToString() + ", " + element3.ToString() + ...
是否有比使用StringBuilder更短的方式並通過MoveNext()循環遍歷元素?
您仍然可以使用LINQ:
String.Join(", ", thingy.Cast<object>());
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.