How does index in the example below get its value? I understand that n is automatically obtained from the numbers source, but although the meaning is clear, I donβt see how the index is assigned its value:
int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var firstSmallNumbers = numbers.TakeWhile((n, index) => n >= index);
Signature TakeWhile :
public static IEnumerable<TSource> TakeWhile<TSource>(this IEnumerable<TSource> source, Func<TSource, int, bool> predicate);
source share