ImmutableArrayExtensions.LastOrDefault 方法

定义

重载

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>)

返回集合中的最后一个元素;如果集合为空,则返回默认值。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>)

返回序列中的最后一个元素;如果序列中不包含任何元素,则返回默认值。Returns the last element of a sequence, or a default value if the sequence contains no elements.

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

类型参数

T

集合包含的元素的类型。The type of element contained by the collection.

参数

immutableArray
ImmutableArray<T>

要从中检索项的数组。The array to retrieve items from.

返回

T

序列中的最后一个元素;如果序列中不包含任何元素,则为默认值。The last element of a sequence, or a default value if the sequence contains no elements.

LastOrDefault<T>(ImmutableArray<T>)

返回集合中的最后一个元素;如果集合为空,则返回默认值。Returns the last element in the collection, or the default value if the collection is empty.

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

类型参数

T

生成器中的项类型。The type of item in the builder.

参数

builder
ImmutableArray<T>.Builder

要从中检索元素的生成器。The builder to retrieve an element from.

返回

T

序列中的最后一个元素;如果序列中不包含任何元素,则为默认值。The last element of a sequence, or a default value if the sequence contains no elements.

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.

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

类型参数

T

集合包含的元素的类型。The type of element contained by the collection.

参数

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.

返回

T

序列中的最后一个元素;如果序列中不包含任何元素,则为默认值。The last element of a sequence, or a default value if the sequence contains no elements.

适用于