AsyncEnumerable.DefaultIfEmpty Method (System.Linq) (original) (raw)

Definition

Namespace:

System.Linq

Assembly:

System.Linq.AsyncEnumerable.dll

Package:

System.Linq.AsyncEnumerable v10.0.0-preview.4.25258.110

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

DefaultIfEmpty(IAsyncEnumerable)

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

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

Returns

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

Exceptions

Applies to

DefaultIfEmpty(IAsyncEnumerable, 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

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

defaultValue

TSource

The value to return if the sequence is empty.

Returns

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

Exceptions

Applies to