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);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")]
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>
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")>]
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) 생성된 제네릭 메서드로 자신을 호출 Skip<TSource>(IQueryable<TSource>, Int32) 하는 것을 나타내는 메서드를 생성 MethodCallExpression 합니다. 그런 다음 매개 변수의 IQueryProvider 속성 source 이 나타내는 메서드에 Provider 전달 MethodCallExpressionCreateQuery(Expression) 합니다.
호출 Skip<TSource>(IQueryable<TSource>, Int32) 을 나타내는 식 트리를 실행한 결과로 발생하는 쿼리 동작은 매개 변수 형식의 source 구현에 따라 달라집니다. 예상되는 동작은 첫 번째 count 요소를 source 건너뛰고 나머지 요소를 반환하는 것입니다.