{TOC}
| Namespace: | System.Linq |
| Assembly: | System.Core.dll |
| Extends: | IEnumerable<T> |
Back to
Standard Query Operator IndexEditIntroduction
The DefaultIfEmpty operator supplies a default element for an empty sequence. One use of this operator is when performing outer joins on two sequences as in the
Outer Join Sample.
EditMethod Signatures
// 1 - Returns the source sequence, or the default(TSource) if the source sequence has no elements
public static IEnumerable<TSource> DefaultIfEmpty<TSource>(
this IEnumerable<TSource> source)
// 2 - Returns the source sequence, or the defaultValue specified if the source sequence has no elements.
public static IEnumerable<TSource> DefaultIfEmpty<TSource>(
this IEnumerable<TSource> source,
TSource defaultValue)EditExceptions
Throws an ArgumentNullException if
source is null
EditPseudo-code
EditLoop Count
EditCode Samples
TODO:Needs code sample.