int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
int oddNumbers = numbers.Count(n => n % 2 == 1);
var firstNumbersLessThan6 = numbers.TakeWhile(n => n < 6);
var firstSmallNumbers = numbers.TakeWhile((n, index) => n >= index);
These are C# code taken from http://msdn.microsoft.com/en-us/library/bb397687.aspx
I understand the first two lambda expressions just fine by considering n as an element of the array "numbers".
However the third lambda expression is really confusing with "index". Is (n,index) one of the lambda parameters well established for arrays? Is this a convention?
TakeWhile()accepts. You can read about it here: msdn.microsoft.com/en-us/library/vstudio/…. Check out the predicate parameter.