Skip While

The SkipWhile method takes a boolean predicate as a parameter. It will skip items in the array or element until the condition is no longer true. On the first occurrence where the condition is false it will return the remaining items in the array.

Basic example

Take a look at the example below. We have a boolean condition of i > 50. The first item is 87. 87 is greater than 50, so we move onto the next item in the list. 56 is greater than 50, let's continue. 33 is not greater than 50. So, we stop there and return the remaining items.

Live example:

var scores = new[] { 87, 56, 33, 20, 11 };

var result = scores.SkipWhile(i => i > 50); // skip until this condition fails.Then return the rest of the list

//output 33, 20, 11