AsyncEnumerable.Take 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| Take<TSource>(IAsyncEnumerable<TSource>, Range) |
傳回序列中連續專案的指定範圍。 |
| Take<TSource>(IAsyncEnumerable<TSource>, Int32) |
從序列開頭傳回指定的連續項目數目。 |
Take<TSource>(IAsyncEnumerable<TSource>, Range)
- 來源:
- Take.cs
- 來源:
- Take.cs
- 來源:
- 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<T>包含序列中range指定的source元素。
例外狀況
source 是 null。
備註
此方法透過延遲執行實現。 立即回傳值是一個物件,儲存執行動作所需的所有資訊。 此方法所表示的查詢,直到物件被枚舉,無論是直接呼叫其「GetEnumerator」方法,或在 Visual C# 中使用「foreach」或在 Visual Basic 中使用「For Each」,才會執行查詢。
取枚舉 source ,並產生索引屬於指定 range元素的元素。
適用於
Take<TSource>(IAsyncEnumerable<TSource>, Int32)
- 來源:
- Take.cs
- 來源:
- Take.cs
- 來源:
- 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<T>一個包含輸入序列起始點指定元素數量的 。
例外狀況
source 是 null。