Get next N elements from enumerable

后端 未结 10 1513
遥遥无期
遥遥无期 2020-12-16 17:38

Context: C# 3.0, .Net 3.5
Suppose I have a method that generates random numbers (forever):

private static IEnumerable RandomNumberGenerator(         


        
10条回答
  •  半阙折子戏
    2020-12-16 18:21

    Are Skip and Take of any use to you?

    Use a combination of the two in a loop to get what you want.

    So,

    list.Skip(10).Take(10);
    

    Skips the first 10 records and then takes the next 10.

提交回复
热议问题