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

定义

返回一个新的可查询序列,它包含 count 中的最后 source 个元素。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>

一个新的可查询序列,它包含 count 中的最后 source 个元素。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.

适用于