ImmutableArrayExtensions.FirstOrDefault Method

Definition

Overloads

FirstOrDefault<T>(ImmutableArray<T>)

Returns the first element of a sequence, or a default value if the sequence contains no elements.

FirstOrDefault<T>(ImmutableArray<T>.Builder)

Returns the first element in the collection, or the default value if the collection is empty.

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

Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.

FirstOrDefault<T>(ImmutableArray<T>)

Source:
ImmutableArrayExtensions.cs
Source:
ImmutableArrayExtensions.cs
Source:
ImmutableArrayExtensions.cs
Source:
ImmutableArrayExtensions.cs

Returns the first element of a sequence, or a default value if the sequence contains no elements.

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

Type Parameters

T

The type of element contained by the collection.

Parameters

immutableArray
ImmutableArray<T>

The array to retrieve items from.

Returns

T

The first item in the list, if found; otherwise the default value for the item type.

Applies to

FirstOrDefault<T>(ImmutableArray<T>.Builder)

Source:
ImmutableArrayExtensions.cs
Source:
ImmutableArrayExtensions.cs
Source:
ImmutableArrayExtensions.cs
Source:
ImmutableArrayExtensions.cs

Returns the first element in the collection, or the default value if the collection is empty.

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

Type Parameters

T

The type of item in the builder.

Parameters

builder
ImmutableArray<T>.Builder

The builder to retrieve an element from.

Returns

T

The first item in the list, if found; otherwise the default value for the item type.

Applies to

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

Source:
ImmutableArrayExtensions.cs
Source:
ImmutableArrayExtensions.cs
Source:
ImmutableArrayExtensions.cs
Source:
ImmutableArrayExtensions.cs

Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static T FirstOrDefault(System::Collections::Immutable::ImmutableArray<T> immutableArray, Func<T, bool> ^ predicate);
public static T FirstOrDefault<T> (this System.Collections.Immutable.ImmutableArray<T> immutableArray, Func<T,bool> predicate);
public static T? FirstOrDefault<T> (this System.Collections.Immutable.ImmutableArray<T> immutableArray, Func<T,bool> predicate);
static member FirstOrDefault : System.Collections.Immutable.ImmutableArray<'T> * Func<'T, bool> -> 'T
<Extension()>
Public Function FirstOrDefault(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

immutableArray
ImmutableArray<T>

The array to retrieve elements from.

predicate
Func<T,Boolean>

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

Returns

T

The first item in the list, if found; otherwise the default value for the item type.

Applies to