Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ParallelEnumerable.DefaultIfEmpty Method

Definition

Namespace:
System.Linq
Assemblies:
System.Core.dll, System.Linq.Parallel.dll
Assemblies:
netstandard.dll, System.Linq.Parallel.dll
Assembly:
System.Linq.Parallel.dll
Assembly:
System.Core.dll
Assembly:
netstandard.dll

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.

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

Overloads

Name Description
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
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
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


Feedback

Was this page helpful?