ImmutableArrayExtensions::SingleOrDefault<T> Method (ImmutableArray<T>, Func<T, Boolean>^)
Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.
Assembly: System.Collections.Immutable (in System.Collections.Immutable.dll)
public: generic<typename T> [ExtensionAttribute] static T SingleOrDefault( ImmutableArray<T> immutableArray, Func<T, bool>^ predicate )
Parameters
- immutableArray
-
Type:
System.Collections.Immutable::ImmutableArray<T>
The array to get the element from.
- predicate
-
Type:
System::Func<T, Boolean>^
The condition the element must satisfy.
Return Value
Type: TThe element if it satisfies the specified condition; otherwise the default element.
Type Parameters
- T
The type of element contained by the collection.
Show: