IEnumerable<T>.DefaultIfEmpty Method

Overloads

DefaultIfEmpty

Returns the elements of the sequence or the default value in a sequence if the sequence is empty.

DefaultIfEmpty(T)

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

DefaultIfEmpty

Returns the elements of the sequence or the default value in a sequence if the sequence is empty.

Delphi
function DefaultIfEmpty: IEnumerable<T>

Returns

IEnumerable<T>

A sequence that contains Default(T) if source is empty; otherwise, source .

DefaultIfEmpty(T)

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

Delphi
function DefaultIfEmpty(const defaultValue: T): IEnumerable<T>

Parameters

defaultValue
T

The value to return if the sequence is empty.

Returns

IEnumerable<T>

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