.NET Framework Class Library
Enumerable..::.DefaultIfEmpty Method

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

Overload List

  NameDescription
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkDefaultIfEmpty<(Of <(TSource>)>)(IEnumerable<(Of <(TSource>)>))Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkDefaultIfEmpty<(Of <(TSource>)>)(IEnumerable<(Of <(TSource>)>), TSource)Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.
Top
See Also

Reference

Tags :


Community Content

Ben Fulton
Default value of a reference object is null
Calling the empty DefaultIfEmpty<MyClass>() returns null. You have to pass a parameter to get the default constructor:

DefaultIfEmpty( new MyClass() )
Tags :

Page view tracker