英語で読む

次の方法で共有


Enumerable.SkipLast<TSource>(IEnumerable<TSource>, Int32) メソッド

定義

source の要素と、省略されたソース コレクションの最後の count 要素を含む、列挙可能な新しいコレクションを返します。

C#
public static System.Collections.Generic.IEnumerable<TSource> SkipLast<TSource> (this System.Collections.Generic.IEnumerable<TSource> source, int count);

型パラメーター

TSource

列挙可能なコレクション内の要素の型。

パラメーター

source
IEnumerable<TSource>

列挙可能なコレクション インスタンス。

count
Int32

コレクションの末尾から省略する要素の数。

戻り値

IEnumerable<TSource>

コレクションの最後の count 要素を引いた、source の要素を含む、列挙可能な新しいシーケンス。

例外

sourcenull です。

注釈

が正の数でない場合 count 、このメソッドは列挙可能なコレクションの同じコピーを source 返します。

適用対象

製品 バージョン
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Standard 2.1