Permalink
Fetching contributors…
Cannot retrieve contributors at this time
75 lines (61 sloc) 2.78 KB
title ms.date ms.prod ms.reviewer ms.suite ms.technology ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author translation.priority.ht
Skip While Clause (Visual Basic)
2015-07-20
.net
devlang-visual-basic
article
vb.QuerySkipWhile
VB
Skip While statement
Skip While clause
queries [Visual Basic], Skip While
5dee8350-7520-4f1a-b00d-590cacd572d6
16
dotnet-bot
dotnetcontent
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

Skip While Clause (Visual Basic)

Bypasses elements in a collection as long as a specified condition is true and then returns the remaining elements.

Syntax

Skip While expression  

Parts

Term Definition
expression Required. An expression that 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.

Remarks

The Skip While clause bypasses 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. The expression is ignored for the remaining results.

The Skip While clause differs from the Where clause in that the Where clause can be used to exclude all elements from a query that do not meet a particular condition. The Skip While clause excludes elements only until the first time that the condition is not satisfied. The Skip While clause is most useful when you are working with an ordered query result.

You can bypass a specific number of results from the beginning of a query result by using the Skip clause.

Example

The following code example uses the Skip While clause to bypass results until the first customer from the United States is found.

[!code-vbVbSimpleQuerySamples#3]

See Also

Introduction to LINQ in Visual Basic
Queries
Select Clause
From Clause
Skip Clause
Take While Clause
Where Clause