Elegant way to combine multiple collections of elements?

前端 未结 11 2404
再見小時候
再見小時候 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:26

    Given that you're starting with a bunch of separate collections, I think your solution is rather elegant. You're going to have to do something to stitch them together.

    It would be more convenient syntactically to make an extension method out of your Combine method, which would make it available anywhere you go.

提交回复
热议问题