語言

AsyncEnumerable.DefaultIfEmpty 方法

定義

多載

名稱 Description
DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>)

回傳指定序列的元素,若序列為空,則回傳該型別參數的預設值。

DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>, TSource)

回傳指定序列的元素,若序列為空,則回傳指定值。

DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>)

來源:
DefaultIfEmpty.cs
來源:
DefaultIfEmpty.cs
來源:
DefaultIfEmpty.cs

回傳指定序列的元素,若序列為空,則回傳該型別參數的預設值。

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。

例外狀況

sourcenull

適用於

DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>, TSource)

來源:
DefaultIfEmpty.cs
來源:
DefaultIfEmpty.cs
來源:
DefaultIfEmpty.cs

回傳指定序列的元素,若序列為空,則回傳指定值。

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。

例外狀況

sourcenull

適用於