Queryable.SkipWhile Queryable.SkipWhile Queryable.SkipWhile Queryable.SkipWhile Method

Definition

指定された条件が満たされる限り、シーケンスの要素をバイパスした後、残りの要素を返します。 Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.

Overloads

SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>) SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>) SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>) SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>)

指定された条件が満たされる限り、シーケンスの要素をバイパスした後、残りの要素を返します。 Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.

SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>) SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>) SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>) SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>)

指定された条件が満たされる限り、シーケンスの要素をバイパスした後、残りの要素を返します。 Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. 要素のインデックスは、述語関数のロジックで使用されます。 The element's index is used in the logic of the predicate function.

SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>) SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>) SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>) SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>)

指定された条件が満たされる限り、シーケンスの要素をバイパスした後、残りの要素を返します。 Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::IQueryable<TSource> ^ SkipWhile(System::Linq::IQueryable<TSource> ^ source, System::Linq::Expressions::Expression<Func<TSource, bool> ^> ^ predicate);
public static System.Linq.IQueryable<TSource> SkipWhile<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,bool>> predicate);
static member SkipWhile : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, bool>> -> System.Linq.IQueryable<'Source>
<Extension()>
Public Function SkipWhile(Of TSource) (source As IQueryable(Of TSource), predicate As Expression(Of Func(Of TSource, Boolean))) As IQueryable(Of TSource)

Type Parameters

TSource

要素の型ソースします。 The type of the elements of source.

パラメーター

source
IQueryable<TSource>

返される要素が含まれる IQueryable<T> An IQueryable<T> to return elements from.

predicate
Expression<Func<TSource,Boolean>>

各要素が条件を満たしているかどうかをテストする関数。 A function to test each element for a condition.

Returns

IQueryable<TSource>

source で指定されたテストに合格しない連続する最初の要素から predicate の要素を含む IQueryable<T> An IQueryable<T> that contains elements from source starting at the first element in the linear series that does not pass the test specified by predicate.

Exceptions

source または predicatenull です。 source or predicate is null.

Examples

次のコード例は、使用する方法を示しますSkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>)条件が true であれば、配列の要素をスキップします。The following code example demonstrates how to use SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>) to skip elements of an array as long as a condition is true.

int[] grades = { 59, 82, 70, 56, 92, 98, 85 };

// Get all grades less than 80 by first
// sorting the grades in descending order and then
// taking all the grades after the first grade
// that is less than 80.
IEnumerable<int> lowerGrades =
    grades.AsQueryable()
    .OrderByDescending(grade => grade)
    .SkipWhile(grade => grade >= 80);

Console.WriteLine("All grades below 80:");
foreach (int grade in lowerGrades)
    Console.WriteLine(grade);

/*
    This code produces the following output:

    All grades below 80:
    70
    59
    56
*/

Dim grades() As Integer = {59, 82, 70, 56, 92, 98, 85}

' Get all grades less than 80 by first  sorting the grades 
' in descending order and then taking all the grades that 
' occur after the first grade that is less than 80.
Dim lowerGrades = grades.AsQueryable() _
    .OrderByDescending(Function(grade) grade) _
    .SkipWhile(Function(grade) grade >= 80)

Dim output As New System.Text.StringBuilder
output.AppendLine("All grades below 80:")
For Each grade As Integer In lowerGrades
    output.AppendLine(grade)
Next

' Display the output.
MsgBox(output.ToString())

' This code produces the following output:

' All grades below 80:
' 70
' 59
' 56

Remarks

このメソッドは、少なくとも 1 つのパラメーター型のExpression<TDelegate>型引数は、のいずれか、Func<T,TResult>型。This method has at least one parameter of type Expression<TDelegate> whose type argument is one of the Func<T,TResult> types. ラムダ式で、これらのパラメーターを渡すことができますにコンパイルされると、Expression<TDelegate>します。For these parameters, you can pass in a lambda expression and it will be compiled to an Expression<TDelegate>.

SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>)メソッドを生成、MethodCallExpression呼び出しを表すSkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>)として構築されたジェネリック メソッド自体。The SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>) method generates a MethodCallExpression that represents calling SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>) itself as a constructed generic method. これは、後、渡します、MethodCallExpressionCreateQuery(Expression)のメソッド、IQueryProviderによって表される、Providerのプロパティ、sourceパラメーター。It then passes the MethodCallExpression to the CreateQuery(Expression) method of the IQueryProvider represented by the Provider property of the source parameter.

呼び出し元を表す式ツリーを実行した結果として発生するクエリの動作SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>)の型の実装によって異なります、sourceパラメーター。The query behavior that occurs as a result of executing an expression tree that represents calling SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>) depends on the implementation of the type of the source parameter. 想定される動作が適用されるpredicate内の各要素にsource対象の要素が見つかるまでpredicatefalse を返します。The expected behavior is that it applies predicate to each element in source until it finds an element for which predicate returns false. その要素の残りのすべての要素が返されます。That element and all the remaining elements are returned.

SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>) SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>) SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>) SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>)

指定された条件が満たされる限り、シーケンスの要素をバイパスした後、残りの要素を返します。 Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. 要素のインデックスは、述語関数のロジックで使用されます。 The element's index is used in the logic of the predicate function.

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::IQueryable<TSource> ^ SkipWhile(System::Linq::IQueryable<TSource> ^ source, System::Linq::Expressions::Expression<Func<TSource, int, bool> ^> ^ predicate);
public static System.Linq.IQueryable<TSource> SkipWhile<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,int,bool>> predicate);
static member SkipWhile : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, int, bool>> -> System.Linq.IQueryable<'Source>
<Extension()>
Public Function SkipWhile(Of TSource) (source As IQueryable(Of TSource), predicate As Expression(Of Func(Of TSource, Integer, Boolean))) As IQueryable(Of TSource)

Type Parameters

TSource

要素の型ソースします。 The type of the elements of source.

パラメーター

source
IQueryable<TSource>

返される要素が含まれる IQueryable<T> An IQueryable<T> to return elements from.

predicate
Expression<Func<TSource,Int32,Boolean>>

各要素が条件に当てはまるかどうかをテストする関数。この関数の 2 つ目のパラメーターは、ソース要素のインデックスを表します。 A function to test each element for a condition; the second parameter of this function represents the index of the source element.

Returns

IQueryable<TSource>

source で指定されたテストに合格しない連続する最初の要素から predicate の要素を含む IQueryable<T> An IQueryable<T> that contains elements from source starting at the first element in the linear series that does not pass the test specified by predicate.

Exceptions

source または predicatenull です。 source or predicate is null.

Examples

次のコード例は、使用する方法を示しますSkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>)要素のインデックスに依存している条件が true であれば、配列の要素をスキップします。The following code example demonstrates how to use SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>) to skip elements of an array as long as a condition that depends on the element's index is true.

int[] amounts = { 5000, 2500, 9000, 8000, 
                    6500, 4000, 1500, 5500 };

// Skip over amounts in the array until the first amount
// that is less than or equal to the product of its
// index in the array and 1000. Take the remaining items.
IEnumerable<int> query =
    amounts.AsQueryable()
    .SkipWhile((amount, index) => amount > index * 1000);

foreach (int amount in query)
    Console.WriteLine(amount);

/*
    This code produces the following output:

    4000
    1500
    5500
*/

Dim amounts() As Integer = {5000, 2500, 9000, 8000, _
                    6500, 4000, 1500, 5500}

' Skip over amounts in the array until the first amount
' that is less than or equal to the product of its
' index in the array and 1000. Take the remaining items.
Dim query = amounts.AsQueryable() _
    .SkipWhile(Function(amount, index) amount > index * 1000)

Dim output As New System.Text.StringBuilder
For Each amount As Integer In query
    output.AppendLine(amount)
Next

' Display the output.
MsgBox(output.ToString())

' This code produces the following output:

' 4000
' 1500
' 5500

Remarks

このメソッドは、少なくとも 1 つのパラメーター型のExpression<TDelegate>型引数は、のいずれか、Func<T,TResult>型。This method has at least one parameter of type Expression<TDelegate> whose type argument is one of the Func<T,TResult> types. ラムダ式で、これらのパラメーターを渡すことができますにコンパイルされると、Expression<TDelegate>します。For these parameters, you can pass in a lambda expression and it will be compiled to an Expression<TDelegate>.

SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>)メソッドを生成、MethodCallExpression呼び出しを表すSkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>)として構築されたジェネリック メソッド自体。The SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>) method generates a MethodCallExpression that represents calling SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>) itself as a constructed generic method. これは、後、渡します、MethodCallExpressionCreateQuery(Expression)のメソッド、IQueryProviderによって表される、Providerのプロパティ、sourceパラメーター。It then passes the MethodCallExpression to the CreateQuery(Expression) method of the IQueryProvider represented by the Provider property of the source parameter.

呼び出し元を表す式ツリーを実行した結果として発生するクエリの動作SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>)の型の実装によって異なります、sourceパラメーター。The query behavior that occurs as a result of executing an expression tree that represents calling SkipWhile<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32,Boolean>>) depends on the implementation of the type of the source parameter. 想定される動作が適用されるpredicate内の各要素にsource対象の要素が見つかるまでpredicatefalse を返します。The expected behavior is that it applies predicate to each element in source until it finds an element for which predicate returns false. その要素の残りのすべての要素が返されます。That element and all the remaining elements are returned. 各ソース要素のインデックスが 2 番目の引数として提供されるpredicateします。The index of each source element is provided as the second argument to predicate.

Applies to