How to convert System.Linq.Enumerable.WhereListIterator to List?

后端 未结 3 825
南方客
南方客 2020-12-16 14:54

In the below example, how can I easily convert eventScores to List so that I can use it as a parameter for prettyPrint?

3条回答
  •  春和景丽
    2020-12-16 15:47

    You'd use the ToList extension:

    var evenScores = scores.Where(i => i % 2 == 0).ToList();
    

提交回复
热议问题