DefaultIfEmpty method

Enumerable<T> DefaultIfEmpty (T value)

Returns either this enumerable or a new enumerable containing value if this enumerable is empty.

If the number of elements in this enumerable is zero, DefaultIfEmpty will return a new enumerable that consists of a single element specified by the given value.

If this enumerable has one or more elements, the enumerable is returned without modification.

Implementation

Enumerable<T> DefaultIfEmpty(T value) {
  return DefaultIfEmptyEnumerable<T>(this, value);
}