Enumerable.SkipLast<TSource>(IEnumerable<TSource>, Int32) 方法

定義

回傳一個新的可枚舉集合,包含 的 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>

一個新的可枚舉集合,包含集合末尾的元素sourcecount

例外狀況

sourcenull

備註

count 不是正數,此方法回 source 傳的可枚舉集合的副本相同。

適用於