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);
C#
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
相同副本。
产品 | 版本 |
---|---|
.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 |