ImmutableArrayExtensions.Single ImmutableArrayExtensions.Single ImmutableArrayExtensions.Single ImmutableArrayExtensions.Single Method

Definition

Overloads

Single<T>(ImmutableArray<T>) Single<T>(ImmutableArray<T>) Single<T>(ImmutableArray<T>) Single<T>(ImmutableArray<T>)

Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.

Single<T>(ImmutableArray<T>, Func<T,Boolean>) Single<T>(ImmutableArray<T>, Func<T,Boolean>) Single<T>(ImmutableArray<T>, Func<T,Boolean>) Single<T>(ImmutableArray<T>, Func<T,Boolean>)

Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.

Single<T>(ImmutableArray<T>) Single<T>(ImmutableArray<T>) Single<T>(ImmutableArray<T>) Single<T>(ImmutableArray<T>)

Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static T Single(System::Collections::Immutable::ImmutableArray<T> immutableArray);
public static T Single<T> (this System.Collections.Immutable.ImmutableArray<T> immutableArray);
static member Single : System.Collections.Immutable.ImmutableArray<'T> -> 'T
<Extension()>
Public Function Single(Of T) (immutableArray As ImmutableArray(Of T)) As T

Type Parameters

T

The type of element contained by the collection.

Parameters

immutableArray
ImmutableArray<T> ImmutableArray<T> ImmutableArray<T> ImmutableArray<T>

The array to retrieve the element from.

Returns

T T T T

The element in the sequence.

Single<T>(ImmutableArray<T>, Func<T,Boolean>) Single<T>(ImmutableArray<T>, Func<T,Boolean>) Single<T>(ImmutableArray<T>, Func<T,Boolean>) Single<T>(ImmutableArray<T>, Func<T,Boolean>)

Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static T Single(System::Collections::Immutable::ImmutableArray<T> immutableArray, Func<T, bool> ^ predicate);
public static T Single<T> (this System.Collections.Immutable.ImmutableArray<T> immutableArray, Func<T,bool> predicate);
static member Single : System.Collections.Immutable.ImmutableArray<'T> * Func<'T, bool> -> 'T
<Extension()>
Public Function Single(Of T) (immutableArray As ImmutableArray(Of T), predicate As Func(Of T, Boolean)) As T

Type Parameters

T

The type of element contained by the collection.

Parameters

predicate
Func<T,Boolean>

Returns

T T T T

Returns Boolean.

Applies to