Enumerable.SkipLast<TSource>(IEnumerable<TSource>, Int32) 方法
定义
返回一个新的可枚举集合,它包含 source
中的元素,但省略了源集合中的 count
个元素。Returns a new enumerable collection that contains the elements from source
with the last count
elements of the source collection omitted.
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
可枚举集合中的元素的类型。The type of the elements in the enumerable collection.
参数
- source
- IEnumerable<TSource>
可枚举的集合实例。An enumerable collection instance.
- count
- Int32
从集合末尾起省略的元素数。The number of elements to omit from the end of the collection.
返回
- IEnumerable<TSource>
一个新的可枚举集合,它包含 source
中的元素,但要减去从集合末尾算起的 count
个元素。A new enumerable collection that contains the elements from source
minus count
elements from the end of the collection.
例外
source
为 null
。source
is null
.
注解
如果不是 count
正数,则此方法返回可枚举集合的相同副本 source
。If count
is not a positive number, this method returns an identical copy of the source
enumerable collection.