我有的IEnumerable与其中的两个实例; T>
(具有相同 T
)。我想的IEnumerable℃的新实例; T>
这是双方的串联
I have two instances of IEnumerable<T>
(with the same T
). I want a new instance of IEnumerable<T>
which is the concatenation of both.
有没有在.net中一个内置的方法,这样做或做我必须写我自己?
Is there a build-in method in .Net to do that or do I have to write it myself?
是,LINQ到对象支持这一带的 Enumerable.Concat
:
Yes, LINQ to Objects supports this with Enumerable.Concat
:
var together = first.Concat(second);
上一篇:SqlParameter有已经包含在另一个SqlParameterCollection - 是否使用(){}作弊?SqlParameter、SqlParameterCollection
下一篇:是否.Disposing使用StreamWriter关闭底层流?底层、Disposing、StreamWriter