Queryable.Skip<TSource>(IQueryable<TSource>, Int32) Yöntem

Tanım

Bir dizideki belirtilen sayıda öğeyi atlar ve sonra kalan öğeleri döndürür.

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)

Tür Parametreleri

TSource

öğelerinin sourcetürü.

Parametreler

source
IQueryable<TSource>

IQueryable<T> Öğesinden öğe döndürmek için.

count
Int32

Kalan öğeleri döndürmeden önce atlana öğelerin sayısı.

Döndürülenler

IQueryable<TSource>

IQueryable<T> Giriş dizisinde belirtilen dizinden sonra oluşan öğeleri içeren bir.

Özel durumlar

source, null değeridir.

Örnekler

Aşağıdaki kod örneği, sıralanmış dizideki belirtilen sayıda öğeyi atlamak ve kalan öğeleri döndürmek için nasıl kullanılacağını Skip<TSource>(IQueryable<TSource>, Int32) gösterir.

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

Açıklamalar

yöntemi, Skip<TSource>(IQueryable<TSource>, Int32) kendisini oluşturulan genel bir MethodCallExpression yöntem olarak çağırmayı Skip<TSource>(IQueryable<TSource>, Int32) temsil eden bir oluşturur. Daha sonra parametresinin özelliği tarafından Provider temsil edilen yöntemine IQueryProvidersource iletirMethodCallExpression.CreateQuery(Expression)

Çağrıyı Skip<TSource>(IQueryable<TSource>, Int32) temsil eden bir ifade ağacının yürütülmesi sonucunda oluşan sorgu davranışı, parametre türünün uygulanmasına source bağlıdır. Beklenen davranış, içindeki source ilk count öğeleri atlar ve kalan öğeleri döndürür.

Şunlara uygulanır