ImmutableArrayExtensions.ToDictionary 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
ToDictionary<TKey,T>(ImmutableArray<T>, Func<T,TKey>)
根據此陣列的內容建立字典。
public:
generic <typename TKey, typename T>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::Dictionary<TKey, T> ^ ToDictionary(System::Collections::Immutable::ImmutableArray<T> immutableArray, Func<T, TKey> ^ keySelector);
public static System.Collections.Generic.Dictionary<TKey,T> ToDictionary<TKey,T> (this System.Collections.Immutable.ImmutableArray<T> immutableArray, Func<T,TKey> keySelector);
static member ToDictionary : System.Collections.Immutable.ImmutableArray<'T> * Func<'T, 'Key> -> System.Collections.Generic.Dictionary<'Key, 'T>
<Extension()>
Public Function ToDictionary(Of TKey, T) (immutableArray As ImmutableArray(Of T), keySelector As Func(Of T, TKey)) As Dictionary(Of TKey, T)
類型參數
- TKey
索引鍵的類型。
- T
集合所包含之元素的類型。
參數
- immutableArray
- ImmutableArray<T>
要用來建立字典的陣列。
- keySelector
- Func<T,TKey>
索引鍵選取器。
傳回
Dictionary<TKey,T>
新的已初始化字典。
適用於
ToDictionary<TKey,T>(ImmutableArray<T>, Func<T,TKey>, IEqualityComparer<TKey>)
根據此陣列的內容建立字典。
public:
generic <typename TKey, typename T>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::Dictionary<TKey, T> ^ ToDictionary(System::Collections::Immutable::ImmutableArray<T> immutableArray, Func<T, TKey> ^ keySelector, System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public static System.Collections.Generic.Dictionary<TKey,T> ToDictionary<TKey,T> (this System.Collections.Immutable.ImmutableArray<T> immutableArray, Func<T,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey> comparer);
public static System.Collections.Generic.Dictionary<TKey,T> ToDictionary<TKey,T> (this System.Collections.Immutable.ImmutableArray<T> immutableArray, Func<T,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer);
static member ToDictionary : System.Collections.Immutable.ImmutableArray<'T> * Func<'T, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.Dictionary<'Key, 'T>
<Extension()>
Public Function ToDictionary(Of TKey, T) (immutableArray As ImmutableArray(Of T), keySelector As Func(Of T, TKey), comparer As IEqualityComparer(Of TKey)) As Dictionary(Of TKey, T)
類型參數
- TKey
索引鍵的類型。
- T
集合所包含之元素的類型。
參數
- immutableArray
- ImmutableArray<T>
要用來建立字典的陣列。
- keySelector
- Func<T,TKey>
索引鍵選取器。
- comparer
- IEqualityComparer<TKey>
要初始化字典的比較子。
傳回
Dictionary<TKey,T>
新的已初始化字典。
適用於
ToDictionary<TKey,TElement,T>(ImmutableArray<T>, Func<T,TKey>, Func<T,TElement>, IEqualityComparer<TKey>)
根據此陣列的內容建立字典。
public:
generic <typename TKey, typename TElement, typename T>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::Dictionary<TKey, TElement> ^ ToDictionary(System::Collections::Immutable::ImmutableArray<T> immutableArray, Func<T, TKey> ^ keySelector, Func<T, TElement> ^ elementSelector, System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public static System.Collections.Generic.Dictionary<TKey,TElement> ToDictionary<TKey,TElement,T> (this System.Collections.Immutable.ImmutableArray<T> immutableArray, Func<T,TKey> keySelector, Func<T,TElement> elementSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer);
public static System.Collections.Generic.Dictionary<TKey,TElement> ToDictionary<TKey,TElement,T> (this System.Collections.Immutable.ImmutableArray<T> immutableArray, Func<T,TKey> keySelector, Func<T,TElement> elementSelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer);
static member ToDictionary : System.Collections.Immutable.ImmutableArray<'T> * Func<'T, 'Key> * Func<'T, 'Element> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.Dictionary<'Key, 'Element>
<Extension()>
Public Function ToDictionary(Of TKey, TElement, T) (immutableArray As ImmutableArray(Of T), keySelector As Func(Of T, TKey), elementSelector As Func(Of T, TElement), comparer As IEqualityComparer(Of TKey)) As Dictionary(Of TKey, TElement)
類型參數
- TKey
索引鍵的類型。
- TElement
元素的類型。
- T
集合所包含之元素的類型。
參數
- immutableArray
- ImmutableArray<T>
要用來建立字典的陣列。
- keySelector
- Func<T,TKey>
索引鍵選取器。
- elementSelector
- Func<T,TElement>
元素選取器。
- comparer
- IEqualityComparer<TKey>
要初始化字典的比較子。
傳回
Dictionary<TKey,TElement>
新的已初始化字典。
適用於
ToDictionary<TKey,TElement,T>(ImmutableArray<T>, Func<T,TKey>, Func<T,TElement>)
根據此陣列的內容建立字典。
public:
generic <typename TKey, typename TElement, typename T>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::Dictionary<TKey, TElement> ^ ToDictionary(System::Collections::Immutable::ImmutableArray<T> immutableArray, Func<T, TKey> ^ keySelector, Func<T, TElement> ^ elementSelector);
public static System.Collections.Generic.Dictionary<TKey,TElement> ToDictionary<TKey,TElement,T> (this System.Collections.Immutable.ImmutableArray<T> immutableArray, Func<T,TKey> keySelector, Func<T,TElement> elementSelector);
static member ToDictionary : System.Collections.Immutable.ImmutableArray<'T> * Func<'T, 'Key> * Func<'T, 'Element> -> System.Collections.Generic.Dictionary<'Key, 'Element>
<Extension()>
Public Function ToDictionary(Of TKey, TElement, T) (immutableArray As ImmutableArray(Of T), keySelector As Func(Of T, TKey), elementSelector As Func(Of T, TElement)) As Dictionary(Of TKey, TElement)
類型參數
- TKey
索引鍵的類型。
- TElement
元素的類型。
- T
集合所包含之元素的類型。
參數
- immutableArray
- ImmutableArray<T>
要用來建立字典的陣列。
- keySelector
- Func<T,TKey>
索引鍵選取器。
- elementSelector
- Func<T,TElement>
元素選取器。
傳回
Dictionary<TKey,TElement>
新的已初始化字典。