Web developers use optional LINQ Skip While clause to bypass elements from the beginning of a query result until the supplied expression returns false. After expression returns false, the query returns all the remaining elements and the expression is ignored for the remaining result.

C# 8.0 and .NET Core 3.0 – Modern Cross-Platform Development: Build applications with C#, .NET Core, Entity Framework Core, ASP.NET Core, and ML.NET using Visual Studio Code, 4th Edition
ASP.NET Core 3 and Angular 9: Full stack web development with .NET Core 3.1 and Angular 9, 3rd Edition
C# in Depth, 4th Edition

The Skip While clause can be used to exclude elements from a query only until the first time that the condition is not satisfied. The clause is most useful when Web developers are working with an ordered query result.

The Skip While clause has the following syntax:

Skip While expression

where expression is required and represents a condition to test elements for. The expression must return a Boolean value or a functional equivalent, such as an Integer to be evaluated as a Boolean.

The following code example uses the Skip While clause to bypass results until the first client from the UK is found:

 

Public Sub SkipWhileExample()

Dim products = GetProductList()

Dim productList = From prd In products _

Ordey By prd.County

Skip While IsInternationalProduct(prd)

For Each prd in productList

Console.WriteLine(prd.Company & vbTab & prd.Country)

Next

End Sub

 

Public Function IsInternationalProduct(ByVal prd as Product) as Boolean

If prd.Country = “UK” Then Return False

Return True

End Function