Bewerken

Delen via


ParallelEnumerable.DefaultIfEmpty Method

Definition

Returns the elements of the specified parallel sequence or the specified value in a singleton collection if the sequence is empty.

Overloads

DefaultIfEmpty<TSource>(ParallelQuery<TSource>)

Returns the elements of the specified parallel sequence or the type parameter's default value in a singleton collection if the sequence is empty.

DefaultIfEmpty<TSource>(ParallelQuery<TSource>, TSource)

Returns the elements of the specified parallel sequence or the specified value in a singleton collection if the sequence is empty.

DefaultIfEmpty<TSource>(ParallelQuery<TSource>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Returns the elements of the specified parallel sequence or the type parameter's default value in a singleton collection if the sequence is empty.

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::ParallelQuery<TSource> ^ DefaultIfEmpty(System::Linq::ParallelQuery<TSource> ^ source);
public static System.Linq.ParallelQuery<TSource> DefaultIfEmpty<TSource> (this System.Linq.ParallelQuery<TSource> source);
static member DefaultIfEmpty : System.Linq.ParallelQuery<'Source> -> System.Linq.ParallelQuery<'Source>
<Extension()>
Public Function DefaultIfEmpty(Of TSource) (source As ParallelQuery(Of TSource)) As ParallelQuery(Of TSource)

Type Parameters

TSource

The type of the elements of source.

Parameters

source
ParallelQuery<TSource>

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

Returns

A sequence that contains default(TSource) if source is empty; otherwise, source.

Exceptions

source is a null reference (Nothing in Visual Basic).

One or more exceptions occurred during the evaluation of the query.

See also

Applies to

DefaultIfEmpty<TSource>(ParallelQuery<TSource>, TSource)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Returns the elements of the specified parallel sequence or the specified value in a singleton collection if the sequence is empty.

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::ParallelQuery<TSource> ^ DefaultIfEmpty(System::Linq::ParallelQuery<TSource> ^ source, TSource defaultValue);
public static System.Linq.ParallelQuery<TSource> DefaultIfEmpty<TSource> (this System.Linq.ParallelQuery<TSource> source, TSource defaultValue);
static member DefaultIfEmpty : System.Linq.ParallelQuery<'Source> * 'Source -> System.Linq.ParallelQuery<'Source>
<Extension()>
Public Function DefaultIfEmpty(Of TSource) (source As ParallelQuery(Of TSource), defaultValue As TSource) As ParallelQuery(Of TSource)

Type Parameters

TSource

The type of the elements of source.

Parameters

source
ParallelQuery<TSource>

The sequence to return the specified value for if it is empty.

defaultValue
TSource

The value to return if the sequence is empty.

Returns

A sequence that contains defaultValue if source is empty; otherwise, source.

Exceptions

source is a null reference (Nothing in Visual Basic).

One or more exceptions occurred during the evaluation of the query.

See also

Applies to