LINQ SkipWhile Query Operator
By Peter Bromberg
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.
int[] amounts = { 5000, 2500, 9000, 8000,
6500,
4000, 1500, 5500 };
IEnumerable<int> query =
amounts.SkipWhile((amount, index) => amount > index * 1000);
foreach (int amount in query)
{
Console.WriteLine(amount);
}
/*
This code produces the following output:
4000
1500
5500
*/
LINQ SkipWhile Query Operator (937 Views)