Enumerable.TakeLast<TSource>(IEnumerable<TSource>, Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回一个新的可枚举集合,该集合包含来自count的最后source一个元素。
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IEnumerable<TSource> ^ TakeLast(System::Collections::Generic::IEnumerable<TSource> ^ source, int count);
public static System.Collections.Generic.IEnumerable<TSource> TakeLast<TSource>(this System.Collections.Generic.IEnumerable<TSource> source, int count);
static member TakeLast : seq<'Source> * int -> seq<'Source>
<Extension()>
Public Function TakeLast(Of TSource) (source As IEnumerable(Of TSource), count As Integer) As IEnumerable(Of TSource)
类型参数
- TSource
可枚举集合中的元素的类型。
参数
- source
- IEnumerable<TSource>
可枚举集合实例。
- count
- Int32
要从集合末尾获取的元素数。
返回
IEnumerable<TSource>
一个新的可枚举集合,其中包含来自 source. 的上一count个元素。
例外
source 是 null。
注解
如果 count 不是正数,此方法返回空可枚举集合。