Enumerable.DefaultIfEmpty Method

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Returns the elements of an IEnumerable<T>, or a default valued singleton collection if the sequence is empty.

Namespace:   System.Linq
Assembly:  System.Core (in System.Core.dll)

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticDefaultIfEmpty<TSource>(IEnumerable<TSource>)

Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.

System_CAPS_pubmethodSystem_CAPS_staticDefaultIfEmpty<TSource>(IEnumerable<TSource>, TSource)

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

Return to top
Show: