OrderedDictionary<TKey,TValue> 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
OrderedDictionary<TKey,TValue>()
初始化空 OrderedDictionary<TKey,TValue> 類別的新實例
具有預設的初始容量,並使用索引鍵類型的默認相等比較子。
public:
OrderedDictionary();
public OrderedDictionary ();
Public Sub New ()
適用於
OrderedDictionary<TKey,TValue>(IDictionary<TKey,TValue>)
初始化 OrderedDictionary<TKey,TValue> 類別的新實例,其中包含從複製的專案
指定的 IDictionary<TKey,TValue>,並使用索引鍵類型的預設相等比較子。
public:
OrderedDictionary(System::Collections::Generic::IDictionary<TKey, TValue> ^ dictionary);
public OrderedDictionary (System.Collections.Generic.IDictionary<TKey,TValue> dictionary);
new System.Collections.Generic.OrderedDictionary<'Key, 'Value> : System.Collections.Generic.IDictionary<'Key, 'Value> -> System.Collections.Generic.OrderedDictionary<'Key, 'Value>
Public Sub New (dictionary As IDictionary(Of TKey, TValue))
參數
- dictionary
- IDictionary<TKey,TValue>
項目複製到新 OrderedDictionary<TKey,TValue>的 IDictionary<TKey,TValue>。
新集合中專案的初始順序是從提供的字典列舉項目的順序。
例外狀況
dictionary
null
。
適用於
OrderedDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>)
初始化 OrderedDictionary<TKey,TValue> 類別的新實例,其中包含複製的專案
從指定的 IEnumerable<T>,並使用索引鍵類型的預設相等比較子。
public:
OrderedDictionary(System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<TKey, TValue>> ^ collection);
public OrderedDictionary (System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> collection);
new System.Collections.Generic.OrderedDictionary<'Key, 'Value> : seq<System.Collections.Generic.KeyValuePair<'Key, 'Value>> -> System.Collections.Generic.OrderedDictionary<'Key, 'Value>
Public Sub New (collection As IEnumerable(Of KeyValuePair(Of TKey, TValue)))
參數
- collection
- IEnumerable<KeyValuePair<TKey,TValue>>
項目複製到新 OrderedDictionary<TKey,TValue>的 IEnumerable<T>。
新集合中專案的初始順序是從提供的集合列舉項目的順序。
例外狀況
collection
null
。
適用於
OrderedDictionary<TKey,TValue>(IEqualityComparer<TKey>)
初始化空 OrderedDictionary<TKey,TValue> 類別的新實例
具有預設的初始容量,並使用指定的 IEqualityComparer<T>。
public:
OrderedDictionary(System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public OrderedDictionary (System.Collections.Generic.IEqualityComparer<TKey>? comparer);
new System.Collections.Generic.OrderedDictionary<'Key, 'Value> : System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.OrderedDictionary<'Key, 'Value>
Public Sub New (comparer As IEqualityComparer(Of TKey))
參數
- comparer
- IEqualityComparer<TKey>
比較索引鍵時要使用的 IEqualityComparer<T> 實作,
或 null
使用索引鍵類型的預設 EqualityComparer<T>。
適用於
OrderedDictionary<TKey,TValue>(Int32)
初始化空 OrderedDictionary<TKey,TValue> 類別的新實例
具有指定的初始容量,並使用索引鍵類型的默認相等比較子。
public:
OrderedDictionary(int capacity);
public OrderedDictionary (int capacity);
new System.Collections.Generic.OrderedDictionary<'Key, 'Value> : int -> System.Collections.Generic.OrderedDictionary<'Key, 'Value>
Public Sub New (capacity As Integer)
參數
- capacity
- Int32
OrderedDictionary<TKey,TValue> 可以包含的初始項目數目。
例外狀況
容量小於 0。
適用於
OrderedDictionary<TKey,TValue>(IDictionary<TKey,TValue>, IEqualityComparer<TKey>)
初始化 OrderedDictionary<TKey,TValue> 類別的新實例,其中包含從複製的專案
指定的 IDictionary<TKey,TValue>,並使用指定的 IEqualityComparer<T>。
public:
OrderedDictionary(System::Collections::Generic::IDictionary<TKey, TValue> ^ dictionary, System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public OrderedDictionary (System.Collections.Generic.IDictionary<TKey,TValue> dictionary, System.Collections.Generic.IEqualityComparer<TKey>? comparer);
new System.Collections.Generic.OrderedDictionary<'Key, 'Value> : System.Collections.Generic.IDictionary<'Key, 'Value> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.OrderedDictionary<'Key, 'Value>
Public Sub New (dictionary As IDictionary(Of TKey, TValue), comparer As IEqualityComparer(Of TKey))
參數
- dictionary
- IDictionary<TKey,TValue>
項目複製到新 OrderedDictionary<TKey,TValue>的 IDictionary<TKey,TValue>。
新集合中專案的初始順序是從提供的字典列舉項目的順序。
- comparer
- IEqualityComparer<TKey>
比較索引鍵時要使用的 IEqualityComparer<T> 實作,
或 null
使用索引鍵類型的預設 EqualityComparer<T>。
例外狀況
dictionary
null
。
適用於
OrderedDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>)
初始化 OrderedDictionary<TKey,TValue> 類別的新實例,其中包含複製的專案
從指定的 IEnumerable<T>,並使用指定的 IEqualityComparer<T>。
public:
OrderedDictionary(System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<TKey, TValue>> ^ collection, System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public OrderedDictionary (System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> collection, System.Collections.Generic.IEqualityComparer<TKey>? comparer);
new System.Collections.Generic.OrderedDictionary<'Key, 'Value> : seq<System.Collections.Generic.KeyValuePair<'Key, 'Value>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.OrderedDictionary<'Key, 'Value>
Public Sub New (collection As IEnumerable(Of KeyValuePair(Of TKey, TValue)), comparer As IEqualityComparer(Of TKey))
參數
- collection
- IEnumerable<KeyValuePair<TKey,TValue>>
項目複製到新 OrderedDictionary<TKey,TValue>的 IEnumerable<T>。
新集合中專案的初始順序是從提供的集合列舉項目的順序。
- comparer
- IEqualityComparer<TKey>
比較索引鍵時要使用的 IEqualityComparer<T> 實作,
或 null
使用索引鍵類型的預設 EqualityComparer<T>。
例外狀況
collection
null
。
適用於
OrderedDictionary<TKey,TValue>(Int32, IEqualityComparer<TKey>)
初始化空 OrderedDictionary<TKey,TValue> 類別的新實例
具有指定的初始容量,並使用指定的 IEqualityComparer<T>。
public:
OrderedDictionary(int capacity, System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public OrderedDictionary (int capacity, System.Collections.Generic.IEqualityComparer<TKey>? comparer);
new System.Collections.Generic.OrderedDictionary<'Key, 'Value> : int * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.OrderedDictionary<'Key, 'Value>
Public Sub New (capacity As Integer, comparer As IEqualityComparer(Of TKey))
參數
- capacity
- Int32
OrderedDictionary<TKey,TValue> 可以包含的初始項目數目。
- comparer
- IEqualityComparer<TKey>
比較索引鍵時要使用的 IEqualityComparer<T> 實作,
或 null
使用索引鍵類型的預設 EqualityComparer<T>。
例外狀況
容量小於 0。