Can you enumerate a collection in C# out of order?

前端 未结 11 2106
天涯浪人
天涯浪人 2020-12-17 17:15

Is there a way to use a foreach loop to iterate through a collection backwards or in a completely random order?

11条回答
  •  情话喂你
    2020-12-17 18:02

    You could sort the List by supplying your own Comparator and iterate over that one.

提交回复
热议问题