ImmutableArrayExtensions.First Method

Definition

Overloads

First<T>(ImmutableArray<T>)

Returns the first element in an array.

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

Returns the first element in the collection.

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

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

First<T>(ImmutableArray<T>)

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

Returns the first element in an array.

C#
public static T First<T>(this System.Collections.Immutable.ImmutableArray<T> immutableArray);

Type Parameters

T

The type of element contained by the collection.

Parameters

immutableArray
ImmutableArray<T>

The array to get an item from.

Returns

T

The first item in the array.

Exceptions

If the array is empty.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0

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

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

Returns the first element in the collection.

C#
public static T First<T>(this System.Collections.Immutable.ImmutableArray<T>.Builder builder);

Type Parameters

T

The type of items in the array.

Parameters

builder
ImmutableArray<T>.Builder

The builder to retrieve an item from.

Returns

T

The first item in the list.

Exceptions

If the array is empty.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0

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

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

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

C#
public static T First<T>(this System.Collections.Immutable.ImmutableArray<T> immutableArray, Func<T,bool> predicate);

Type Parameters

T

The type of element contained by the collection.

Parameters

immutableArray
ImmutableArray<T>

The array to get an item 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 it meets the condition specified by predicate.

Exceptions

If the array is empty.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0