OrderedDictionary Construtores

Definição

Inicializa uma nova instância da classe OrderedDictionary.Initializes a new instance of the OrderedDictionary class.

Sobrecargas

OrderedDictionary()

Inicializa uma nova instância da classe OrderedDictionary.Initializes a new instance of the OrderedDictionary class.

OrderedDictionary(IEqualityComparer)

Inicializa uma nova instância da classe OrderedDictionary usando o comparador especificado.Initializes a new instance of the OrderedDictionary class using the specified comparer.

OrderedDictionary(Int32)

Inicializa uma nova instância da classe OrderedDictionary usando a capacidade inicial especificada.Initializes a new instance of the OrderedDictionary class using the specified initial capacity.

OrderedDictionary(Int32, IEqualityComparer)

Inicializa uma nova instância da classe OrderedDictionary usando o comparador e a capacidade inicial especificados.Initializes a new instance of the OrderedDictionary class using the specified initial capacity and comparer.

OrderedDictionary(SerializationInfo, StreamingContext)

Inicializa uma nova instância da classe OrderedDictionary que pode ser serializada usando os objetos SerializationInfo e StreamingContext especificados.Initializes a new instance of the OrderedDictionary class that is serializable using the specified SerializationInfo and StreamingContext objects.

OrderedDictionary()

Inicializa uma nova instância da classe OrderedDictionary.Initializes a new instance of the OrderedDictionary class.

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

Exemplos

O exemplo de código a seguir demonstra a criação e a população de uma OrderedDictionary coleção.The following code example demonstrates the creation and population of an OrderedDictionary collection. Esse código é parte de um exemplo de código maior que pode ser exibido em OrderedDictionary .This code is part of a larger code example that can be viewed at OrderedDictionary.

// Creates and initializes a OrderedDictionary.
OrderedDictionary^ myOrderedDictionary = gcnew OrderedDictionary();
myOrderedDictionary->Add("testKey1", "testValue1");
myOrderedDictionary->Add("testKey2", "testValue2");
myOrderedDictionary->Add("keyToDelete", "valueToDelete");
myOrderedDictionary->Add("testKey3", "testValue3");

ICollection^ keyCollection = myOrderedDictionary->Keys;
ICollection^ valueCollection = myOrderedDictionary->Values;

// Display the contents using the key and value collections
DisplayContents(keyCollection, valueCollection, myOrderedDictionary->Count);
// Creates and initializes a OrderedDictionary.
OrderedDictionary myOrderedDictionary = new OrderedDictionary();
myOrderedDictionary.Add("testKey1", "testValue1");
myOrderedDictionary.Add("testKey2", "testValue2");
myOrderedDictionary.Add("keyToDelete", "valueToDelete");
myOrderedDictionary.Add("testKey3", "testValue3");

ICollection keyCollection = myOrderedDictionary.Keys;
ICollection valueCollection = myOrderedDictionary.Values;

// Display the contents using the key and value collections
DisplayContents(keyCollection, valueCollection, myOrderedDictionary.Count);
' Creates and initializes a OrderedDictionary.
Dim myOrderedDictionary As New OrderedDictionary()
myOrderedDictionary.Add("testKey1", "testValue1")
myOrderedDictionary.Add("testKey2", "testValue2")
myOrderedDictionary.Add("keyToDelete", "valueToDelete")
myOrderedDictionary.Add("testKey3", "testValue3")

Dim keyCollection As ICollection = myOrderedDictionary.Keys
Dim valueCollection As ICollection = myOrderedDictionary.Values

' Display the contents Imports the key and value collections
DisplayContents( _
    keyCollection, valueCollection, myOrderedDictionary.Count)

Comentários

O comparador determina se duas chaves são iguais.The comparer determines whether two keys are equal. Cada chave em uma OrderedDictionary coleção deve ser exclusiva.Every key in a OrderedDictionary collection must be unique. O comparador padrão é a implementação da chave de Object.Equals .The default comparer is the key's implementation of Object.Equals.

Aplica-se a

OrderedDictionary(IEqualityComparer)

Inicializa uma nova instância da classe OrderedDictionary usando o comparador especificado.Initializes a new instance of the OrderedDictionary class using the specified comparer.

public:
 OrderedDictionary(System::Collections::IEqualityComparer ^ comparer);
public OrderedDictionary (System.Collections.IEqualityComparer comparer);
public OrderedDictionary (System.Collections.IEqualityComparer? comparer);
new System.Collections.Specialized.OrderedDictionary : System.Collections.IEqualityComparer -> System.Collections.Specialized.OrderedDictionary
Public Sub New (comparer As IEqualityComparer)

Parâmetros

comparer
IEqualityComparer

O IComparer a ser usado para determinar se duas chaves são iguais.The IComparer to use to determine whether two keys are equal.

- ou --or- null para usar o comparador padrão, que é a implementação de cada chave de Equals(Object).null to use the default comparer, which is each key's implementation of Equals(Object).

Comentários

O comparador determina se duas chaves são iguais.The comparer determines whether two keys are equal. Cada chave em uma OrderedDictionary coleção deve ser exclusiva.Every key in a OrderedDictionary collection must be unique. O comparador padrão é a implementação da chave de Object.Equals .The default comparer is the key's implementation of Object.Equals.

O comparador personalizado permite esses cenários como fazer pesquisas com cadeias de caracteres que não diferenciam maiúsculas de minúsculas.The custom comparer enables such scenarios as doing lookups with case-insensitive strings.

Aplica-se a

OrderedDictionary(Int32)

Inicializa uma nova instância da classe OrderedDictionary usando a capacidade inicial especificada.Initializes a new instance of the OrderedDictionary class using the specified initial capacity.

public:
 OrderedDictionary(int capacity);
public OrderedDictionary (int capacity);
new System.Collections.Specialized.OrderedDictionary : int -> System.Collections.Specialized.OrderedDictionary
Public Sub New (capacity As Integer)

Parâmetros

capacity
Int32

O número inicial de elementos que a coleção OrderedDictionary pode conter.The initial number of elements that the OrderedDictionary collection can contain.

Comentários

O comparador determina se duas chaves são iguais.The comparer determines whether two keys are equal. Cada chave em uma OrderedDictionary coleção deve ser exclusiva.Every key in a OrderedDictionary collection must be unique. O comparador padrão é a implementação da chave de Object.Equals .The default comparer is the key's implementation of Object.Equals.

Aplica-se a

OrderedDictionary(Int32, IEqualityComparer)

Inicializa uma nova instância da classe OrderedDictionary usando o comparador e a capacidade inicial especificados.Initializes a new instance of the OrderedDictionary class using the specified initial capacity and comparer.

public:
 OrderedDictionary(int capacity, System::Collections::IEqualityComparer ^ comparer);
public OrderedDictionary (int capacity, System.Collections.IEqualityComparer comparer);
public OrderedDictionary (int capacity, System.Collections.IEqualityComparer? comparer);
new System.Collections.Specialized.OrderedDictionary : int * System.Collections.IEqualityComparer -> System.Collections.Specialized.OrderedDictionary
Public Sub New (capacity As Integer, comparer As IEqualityComparer)

Parâmetros

capacity
Int32

O número inicial de elementos que a coleção OrderedDictionary pode conter.The initial number of elements that the OrderedDictionary collection can contain.

comparer
IEqualityComparer

O IComparer a ser usado para determinar se duas chaves são iguais.The IComparer to use to determine whether two keys are equal.

- ou --or- null para usar o comparador padrão, que é a implementação de cada chave de Equals(Object).null to use the default comparer, which is each key's implementation of Equals(Object).

Comentários

O comparador determina se duas chaves são iguais.The comparer determines whether two keys are equal. Cada chave em uma OrderedDictionary coleção deve ser exclusiva.Every key in a OrderedDictionary collection must be unique. O comparador padrão é a implementação da chave de Object.Equals .The default comparer is the key's implementation of Object.Equals.

O comparador personalizado permite esses cenários como fazer pesquisas com cadeias de caracteres que não diferenciam maiúsculas de minúsculas.The custom comparer enables such scenarios as doing lookups with case-insensitive strings.

Aplica-se a

OrderedDictionary(SerializationInfo, StreamingContext)

Inicializa uma nova instância da classe OrderedDictionary que pode ser serializada usando os objetos SerializationInfo e StreamingContext especificados.Initializes a new instance of the OrderedDictionary class that is serializable using the specified SerializationInfo and StreamingContext objects.

protected:
 OrderedDictionary(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected OrderedDictionary (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Collections.Specialized.OrderedDictionary : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Collections.Specialized.OrderedDictionary
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parâmetros

info
SerializationInfo

Um objeto SerializationInfo que contém as informações necessárias para serializar a coleção OrderedDictionary.A SerializationInfo object containing the information required to serialize the OrderedDictionary collection.

context
StreamingContext

Um objeto StreamingContext que contém a origem e o destino do fluxo serializado associado a OrderedDictionary.A StreamingContext object containing the source and destination of the serialized stream associated with the OrderedDictionary.

Comentários

O comparador determina se duas chaves são iguais.The comparer determines whether two keys are equal. Cada chave em uma OrderedDictionary coleção deve ser exclusiva.Every key in a OrderedDictionary collection must be unique. O comparador padrão é a implementação da chave de Object.Equals .The default comparer is the key's implementation of Object.Equals.

Aplica-se a