![](/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.