ImmutableArrayExtensions::SingleOrDefault<T> Method (ImmutableArray<T>)
Returns the only element of the array, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.
Assembly: System.Collections.Immutable (in System.Collections.Immutable.dll)
public: generic<typename T> [ExtensionAttribute] static T SingleOrDefault( ImmutableArray<T> immutableArray )
Parameters
- immutableArray
- Type: System.Collections.Immutable::ImmutableArray<T>
Return Value
Type: TThe element in the array, or the default value if the array is empty.
Type Parameters
- T
The type of element contained by the collection.
Show: