Queryable.TakeLast<TSource>(IQueryable<TSource>, Int32) 方法

定義

傳回新的可查詢序列,其包含 source 的最後 count 元素。Returns a new queryable sequence that contains the last count elements from source.

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::IQueryable<TSource> ^ TakeLast(System::Linq::IQueryable<TSource> ^ source, int count);
public static System.Linq.IQueryable<TSource> TakeLast<TSource> (this System.Linq.IQueryable<TSource> source, int count);
static member TakeLast : System.Linq.IQueryable<'Source> * int -> System.Linq.IQueryable<'Source>
<Extension()>
Public Function TakeLast(Of TSource) (source As IQueryable(Of TSource), count As Integer) As IQueryable(Of TSource)

類型參數

TSource

可查詢序列中元素的類型。The type of the elements in the queryable sequence.

參數

source
IQueryable<TSource>

可查詢序列執行個體。A queryable sequence instance.

count
Int32

要從可查詢序列末端移除的元素數。The number of elements to take from the end of the queryable sequence.

傳回

IQueryable<TSource>

新的可查詢序列,其包含 source 的最後 count 元素。A new queryable sequence that contains the last count elements from source.

例外狀況

sourcenullsource is null.

備註

如果不是 count 正數,這個方法會傳回空的可查詢序列。If count is not a positive number, this method returns an empty queryable sequence.

適用於