ImmutableArrayExtensions.Single 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| Single<T>(ImmutableArray<T>) |
傳回序列的唯一專案,如果序列中沒有一個專案,則會擲回例外狀況。 |
| Single<T>(ImmutableArray<T>, Func<T,Boolean>) |
傳回序列中唯一符合指定條件的專案,如果有多個這類專案存在,則會擲回例外狀況。 |
Single<T>(ImmutableArray<T>)
傳回序列的唯一專案,如果序列中沒有一個專案,則會擲回例外狀況。
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
類型參數
- T
集合所包含的元素類型。
參數
- immutableArray
- ImmutableArray<T>
從陣列中取回元素。
傳回
T
序列中的元素。
適用於
Single<T>(ImmutableArray<T>, Func<T,Boolean>)
傳回序列中唯一符合指定條件的專案,如果有多個這類專案存在,則會擲回例外狀況。
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
類型參數
- T
集合所包含的元素類型。
參數
- immutableArray
- ImmutableArray<T>
不可變陣列,從中回傳單一元素。
傳回
T
傳回 Boolean。