Elegant way to combine multiple collections of elements?

前端 未结 11 2395
再見小時候
再見小時候 2020-12-05 03:36

Say I have an arbitrary number of collections, each containing objects of the same type (for example, List foo and List bar).

11条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-05 04:28

    Use Enumerable.Concat like so:

    var combined = foo.Concat(bar).Concat(baz)....;
    

提交回复
热议问题