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.

Namespace:   System.Linq
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: T

The element if it satisfies the specified condition; otherwise the default element.

Type Parameters

T

The type of element contained by the collection.

Return to top
Show: