从通用IEnumerable<T>实现转换为T数组的最佳方法是什么?我目前的解决方案如下所示:
IEnumerable<T>
IEnumerable<string> foo = getFoo(); string[] bar = new List<string>(foo).ToArray();
通过一个List<T>似乎不必要的转移,但我还没有找到一个更好的方法来做到这一点.
List<T>
注意:我在这里使用C#2.0.
arrays collections ienumerable .net-2.0 c#-2.0
.net-2.0 ×1
arrays ×1
c#-2.0 ×1
collections ×1
ienumerable ×1