ImmutableArrayExtensions.LastOrDefault Method

Definition

Overloads

LastOrDefault<T>(ImmutableArray<T>)

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

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

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

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

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

LastOrDefault<T>(ImmutableArray<T>)

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

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

C#
public static T LastOrDefault<T>(this System.Collections.Immutable.ImmutableArray<T> immutableArray);
C#
public static T? LastOrDefault<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 retrieve items from.

Returns

T

The last element of a sequence, or a default value if the sequence contains no elements.

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

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

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

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

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

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 last element of a sequence, or a default value if the sequence contains no elements.

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

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

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

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

C#
public static T LastOrDefault<T>(this System.Collections.Immutable.ImmutableArray<T> immutableArray, Func<T,bool> predicate);
C#
public static T? LastOrDefault<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 retrieve an element from.

predicate
Func<T,Boolean>

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

Returns

T

The last element of a sequence, or a default value if the sequence contains no elements.

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