Queryable.Skip<TSource>(IQueryable<TSource>, Int32) メソッド
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
シーケンス内の指定された数の要素をバイパスし、残りの要素を返します。
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static System::Linq::IQueryable<TSource> ^ Skip(System::Linq::IQueryable<TSource> ^ source, int count);
public static System.Linq.IQueryable<TSource> Skip<TSource> (this System.Linq.IQueryable<TSource> source, int count);
static member Skip : System.Linq.IQueryable<'Source> * int -> System.Linq.IQueryable<'Source>
<Extension()>
Public Function Skip(Of TSource) (source As IQueryable(Of TSource), count As Integer) As IQueryable(Of TSource)
- TSource
source
の要素の型。
- source
- IQueryable<TSource>
返される要素が含まれる IQueryable<T>。
- count
- Int32
残りの要素を返す前にスキップする要素の数。
入力シーケンスで指定されたインデックスの後に出現する要素を含む IQueryable<T>。
source
が null
です。
次のコード例では、 を使用 Skip<TSource>(IQueryable<TSource>, Int32) して、並べ替えられた配列内の指定された数の要素をスキップし、残りの要素を返す方法を示します。
int[] grades = { 59, 82, 70, 56, 92, 98, 85 };
// Sort the grades in descending order and
// get all except the first three.
IEnumerable<int> lowerGrades =
grades.AsQueryable().OrderByDescending(g => g).Skip(3);
Console.WriteLine("All grades except the top three are:");
foreach (int grade in lowerGrades)
Console.WriteLine(grade);
/*
This code produces the following output:
All grades except the top three are:
82
70
59
56
*/
Dim grades() As Integer = {59, 82, 70, 56, 92, 98, 85}
' Sort the grades in descending order and
' get all except the first three.
Dim lowerGrades = grades.AsQueryable() _
.OrderByDescending(Function(g) g) _
.Skip(3)
Dim output As New System.Text.StringBuilder
output.AppendLine("All grades except the top three are:")
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 except the top three are:
' 82
' 70
' 59
' 56
メソッドは Skip<TSource>(IQueryable<TSource>, Int32) 、 MethodCallExpression 構築されたジェネリック メソッドとしての呼び出し Skip<TSource>(IQueryable<TSource>, Int32) 自体を表す を生成します。 次に、 パラメーターの MethodCallExpressionCreateQuery(Expression) プロパティで表される の IQueryProvider メソッドに をProvidersource
渡します。
呼び出し Skip<TSource>(IQueryable<TSource>, Int32) を表す式ツリーを実行した結果として発生するクエリ動作は、 パラメーターの型の source
実装によって異なります。 予期される動作は、 のsource
最初count
の要素をスキップし、残りの要素を返すということです。
製品 | バージョン |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。