LINQ C# Book

public void Linq25()

{

int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };



var firstSmallNumbers = numbers.TakeWhile((n, index) => n >= index);



Console.WriteLine("First numbers not less than their position:");

foreach (var n in firstSmallNumbers)

{

Console.WriteLine(n);

}

}
Result

First numbers not less than their position:
5
4