AsyncEnumerable.Take 方法

定义

重载

名称 说明
Take<TSource>(IAsyncEnumerable<TSource>, Int32)

从序列的开头返回指定的连续元素数。

Take<TSource>(IAsyncEnumerable<TSource>, Range)

返回序列中连续元素的指定范围。

Take<TSource>(IAsyncEnumerable<TSource>, Int32)

Source:
Take.cs
Source:
Take.cs
Source:
Take.cs

从序列的开头返回指定的连续元素数。

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Collections::Generic::IAsyncEnumerable<TSource> ^ Take(System::Collections::Generic::IAsyncEnumerable<TSource> ^ source, int count);
public static System.Collections.Generic.IAsyncEnumerable<TSource> Take<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, int count);
static member Take : System.Collections.Generic.IAsyncEnumerable<'Source> * int -> System.Collections.Generic.IAsyncEnumerable<'Source>
<Extension()>
Public Function Take(Of TSource) (source As IAsyncEnumerable(Of TSource), count As Integer) As IAsyncEnumerable(Of TSource)

类型参数

TSource

源元素的类型。

参数

source
IAsyncEnumerable<TSource>

要从中返回元素的序列。

count
Int32

要返回的元素数。

返回

IAsyncEnumerable<TSource>

一个 IAsyncEnumerable<T> 包含输入序列开头的指定数量的元素。

例外

sourcenull

适用于

Take<TSource>(IAsyncEnumerable<TSource>, Range)

Source:
Take.cs
Source:
Take.cs
Source:
Take.cs

返回序列中连续元素的指定范围。

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Collections::Generic::IAsyncEnumerable<TSource> ^ Take(System::Collections::Generic::IAsyncEnumerable<TSource> ^ source, Range range);
public static System.Collections.Generic.IAsyncEnumerable<TSource> Take<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Range range);
static member Take : System.Collections.Generic.IAsyncEnumerable<'Source> * Range -> System.Collections.Generic.IAsyncEnumerable<'Source>
<Extension()>
Public Function Take(Of TSource) (source As IAsyncEnumerable(Of TSource), range As Range) As IAsyncEnumerable(Of TSource)

类型参数

TSource

的元素 source的类型。

参数

source
IAsyncEnumerable<TSource>

要从中返回元素的序列。

range
Range

要返回的元素范围,该元素的起始索引和结束索引是从开始索引还是结束索引。

返回

IAsyncEnumerable<TSource>

一个包含序列中指定IAsyncEnumerable<T>元素的range元素source

例外

sourcenull

注解

此方法是使用延迟执行实现的。 即时返回值是一个对象,用于存储执行操作所需的所有信息。 在枚举对象之前,不会执行此方法表示的查询,方法是直接调用其“GetEnumerator”方法,或在 visual C# 中使用“foreach”或在Visual Basic中使用“Foreach”。

获取枚举 source 并生成其索引属于指定 range元素。

适用于