IEnumerable.defaultIfEmpty Method

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

Parameters

defaultValue

Type: Object
The value to return if this sequence is empty.

Return Value


Type: IEnumerable
An enumerable that contains defaultValue if this sequence is empty; otherwise, this sequence.