Enumerable.SkipLast<TSource>(IEnumerable<TSource>, Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回一个新的可枚举集合,该集合包含从中省略源集合的最后source一个元素的元素count。
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IEnumerable<TSource> ^ SkipLast(System::Collections::Generic::IEnumerable<TSource> ^ source, int count);
public static System.Collections.Generic.IEnumerable<TSource> SkipLast<TSource>(this System.Collections.Generic.IEnumerable<TSource> source, int count);
static member SkipLast : seq<'Source> * int -> seq<'Source>
<Extension()>
Public Function SkipLast(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 不是正数,此方法将返回可枚举集合的 source 相同副本。