AsyncEnumerable.DefaultIfEmpty 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>) |
回傳指定序列的元素,若序列為空,則回傳該型別參數的預設值。 |
| DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>, TSource) |
回傳指定序列的元素,若序列為空,則回傳指定值。 |
DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>)
回傳指定序列的元素,若序列為空,則回傳該型別參數的預設值。
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IAsyncEnumerable<TSource> ^ DefaultIfEmpty(System::Collections::Generic::IAsyncEnumerable<TSource> ^ source);
public static System.Collections.Generic.IAsyncEnumerable<TSource?> DefaultIfEmpty<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source);
static member DefaultIfEmpty : System.Collections.Generic.IAsyncEnumerable<'Source> -> System.Collections.Generic.IAsyncEnumerable<'Source>
<Extension()>
Public Function DefaultIfEmpty(Of TSource) (source As IAsyncEnumerable(Of TSource)) As IAsyncEnumerable(Of TSource)
類型參數
- TSource
來源元素的類型。
參數
- source
- IAsyncEnumerable<TSource>
如果預設值是空的,則傳回的序列。
傳回
IAsyncEnumerable<TSource>
若 IAsyncEnumerable<T> 來源為空,則包含 TSource 類型預設值的物件;否則為 source。
例外狀況
source 是 null。
適用於
DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>, TSource)
回傳指定序列的元素,若序列為空,則回傳指定值。
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IAsyncEnumerable<TSource> ^ DefaultIfEmpty(System::Collections::Generic::IAsyncEnumerable<TSource> ^ source, TSource defaultValue);
public static System.Collections.Generic.IAsyncEnumerable<TSource> DefaultIfEmpty<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, TSource defaultValue);
static member DefaultIfEmpty : System.Collections.Generic.IAsyncEnumerable<'Source> * 'Source -> System.Collections.Generic.IAsyncEnumerable<'Source>
<Extension()>
Public Function DefaultIfEmpty(Of TSource) (source As IAsyncEnumerable(Of TSource), defaultValue As TSource) As IAsyncEnumerable(Of TSource)
類型參數
- TSource
來源元素的類型。
參數
- source
- IAsyncEnumerable<TSource>
如果預設值是空的,則傳回的序列。
- defaultValue
- TSource
如果序列是空的,則傳回的值。
傳回
IAsyncEnumerable<TSource>
若 IAsyncEnumerable<T> 來源為空,則包含 TSource 類型預設值的物件;否則為 source。
例外狀況
source 是 null。