OrderedDictionary<TKey,TValue> Constructors

Definition

Overloads

OrderedDictionary<TKey,TValue>()

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that is empty,

has the default initial capacity, and uses the default equality comparer for the key type.

OrderedDictionary<TKey,TValue>(IDictionary<TKey,TValue>)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that contains elements copied from

the specified IDictionary<TKey,TValue> and uses the default equality comparer for the key type.

OrderedDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that contains elements copied

from the specified IEnumerable<T> and uses the default equality comparer for the key type.

OrderedDictionary<TKey,TValue>(IEqualityComparer<TKey>)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that is empty,

has the default initial capacity, and uses the specified IEqualityComparer<T>.

OrderedDictionary<TKey,TValue>(Int32)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that is empty,

has the specified initial capacity, and uses the default equality comparer for the key type.

OrderedDictionary<TKey,TValue>(IDictionary<TKey,TValue>, IEqualityComparer<TKey>)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that contains elements copied from

the specified IDictionary<TKey,TValue> and uses the specified IEqualityComparer<T>.

OrderedDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that contains elements copied

from the specified IEnumerable<T> and uses the specified IEqualityComparer<T>.

OrderedDictionary<TKey,TValue>(Int32, IEqualityComparer<TKey>)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that is empty,

has the specified initial capacity, and uses the specified IEqualityComparer<T>.

OrderedDictionary<TKey,TValue>()

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that is empty,

has the default initial capacity, and uses the default equality comparer for the key type.

public:
 OrderedDictionary();
public OrderedDictionary ();
Public Sub New ()

Applies to

OrderedDictionary<TKey,TValue>(IDictionary<TKey,TValue>)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that contains elements copied from

the specified IDictionary<TKey,TValue> and uses the default equality comparer for the key type.

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

Parameters

dictionary
IDictionary<TKey,TValue>

The IDictionary<TKey,TValue> whose elements are copied to the new OrderedDictionary<TKey,TValue>.

The initial order of the elements in the new collection is the order the elements are enumerated from the supplied dictionary.

Exceptions

dictionary is null.

Applies to

OrderedDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that contains elements copied

from the specified IEnumerable<T> and uses the default equality comparer for the key type.

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

Parameters

collection
IEnumerable<KeyValuePair<TKey,TValue>>

The IEnumerable<T> whose elements are copied to the new OrderedDictionary<TKey,TValue>.

The initial order of the elements in the new collection is the order the elements are enumerated from the supplied collection.

Exceptions

collection is null.

Applies to

OrderedDictionary<TKey,TValue>(IEqualityComparer<TKey>)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that is empty,

has the default initial capacity, and uses the specified 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))

Parameters

comparer
IEqualityComparer<TKey>

The IEqualityComparer<T> implementation to use when comparing keys,

or null to use the default EqualityComparer<T> for the type of the key.

Applies to

OrderedDictionary<TKey,TValue>(Int32)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that is empty,

has the specified initial capacity, and uses the default equality comparer for the key type.

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)

Parameters

capacity
Int32

The initial number of elements that the OrderedDictionary<TKey,TValue> can contain.

Exceptions

capacity is less than 0.

Applies to

OrderedDictionary<TKey,TValue>(IDictionary<TKey,TValue>, IEqualityComparer<TKey>)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that contains elements copied from

the specified IDictionary<TKey,TValue> and uses the specified 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))

Parameters

dictionary
IDictionary<TKey,TValue>

The IDictionary<TKey,TValue> whose elements are copied to the new OrderedDictionary<TKey,TValue>.

The initial order of the elements in the new collection is the order the elements are enumerated from the supplied dictionary.

comparer
IEqualityComparer<TKey>

The IEqualityComparer<T> implementation to use when comparing keys,

or null to use the default EqualityComparer<T> for the type of the key.

Exceptions

dictionary is null.

Applies to

OrderedDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that contains elements copied

from the specified IEnumerable<T> and uses the specified 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))

Parameters

collection
IEnumerable<KeyValuePair<TKey,TValue>>

The IEnumerable<T> whose elements are copied to the new OrderedDictionary<TKey,TValue>.

The initial order of the elements in the new collection is the order the elements are enumerated from the supplied collection.

comparer
IEqualityComparer<TKey>

The IEqualityComparer<T> implementation to use when comparing keys,

or null to use the default EqualityComparer<T> for the type of the key.

Exceptions

collection is null.

Applies to

OrderedDictionary<TKey,TValue>(Int32, IEqualityComparer<TKey>)

Initializes a new instance of the OrderedDictionary<TKey,TValue> class that is empty,

has the specified initial capacity, and uses the specified 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))

Parameters

capacity
Int32

The initial number of elements that the OrderedDictionary<TKey,TValue> can contain.

comparer
IEqualityComparer<TKey>

The IEqualityComparer<T> implementation to use when comparing keys,

or null to use the default EqualityComparer<T> for the type of the key.

Exceptions

capacity is less than 0.

Applies to