แก้ไข

แชร์ผ่าน


AsyncEnumerable.DefaultIfEmpty Method

Definition

Overloads

DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>)

Returns the elements of the specified sequence or the type parameter's default if the sequence is empty.

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

Returns the elements of the specified sequence or the specified value if the sequence is empty.

DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>)

Source:
DefaultIfEmpty.cs

Returns the elements of the specified sequence or the type parameter's default if the sequence is empty.

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)

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IAsyncEnumerable<TSource>

The sequence to return a default value for if it is empty.

Returns

IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> object that contains the default value for the TSource type if source is empty; otherwise, source.

Exceptions

source is null.

Applies to

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

Source:
DefaultIfEmpty.cs

Returns the elements of the specified sequence or the specified value if the sequence is empty.

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)

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IAsyncEnumerable<TSource>

The sequence to return a default value for if it is empty.

defaultValue
TSource

The value to return if the sequence is empty.

Returns

IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> object that contains the default value for the TSource type if source is empty; otherwise, source.

Exceptions

source is null.

Applies to