ImmutableArrayExtensions::First<T> Method (ImmutableArray<T>, Func<T, Boolean>^)

 

Returns the first element in a sequence that satisfies a specified condition.

Namespace:   System.Linq
Assembly:  System.Collections.Immutable (in System.Collections.Immutable.dll)

public:
generic<typename T>
[ExtensionAttribute]
static T First(
	ImmutableArray<T> immutableArray,
	Func<T, bool>^ predicate
)

Parameters

immutableArray
Type: System.Collections.Immutable::ImmutableArray<T>

The array to get an item from.

predicate
Type: System::Func<T, Boolean>^

The delegate that defines the conditions of the element to search for.

Return Value

Type: T

The first item in the list if it meets the condition specified by predicate.

Type Parameters

T

The type of element contained by the collection.

Exception Condition
InvalidOperationException

If the array is empty.

Return to top
Show: