OrderedDictionary Konstruktory
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Inicializuje novou instanci OrderedDictionary třídy.
Přetížení
| Name | Description |
|---|---|
| OrderedDictionary() |
Inicializuje novou instanci OrderedDictionary třídy. |
| OrderedDictionary(IEqualityComparer) |
Inicializuje novou instanci OrderedDictionary třídy pomocí zadaného porovnávače. |
| OrderedDictionary(Int32) |
Inicializuje novou instanci OrderedDictionary třídy pomocí zadané počáteční kapacity. |
| OrderedDictionary(Int32, IEqualityComparer) |
Inicializuje novou instanci OrderedDictionary třídy pomocí zadané počáteční kapacity a porovnávače. |
| OrderedDictionary(SerializationInfo, StreamingContext) |
Zastaralé.
Inicializuje novou instanci OrderedDictionary třídy, která je serializovatelná pomocí zadané SerializationInfo a StreamingContext objekty. |
OrderedDictionary()
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
Inicializuje novou instanci OrderedDictionary třídy.
public:
OrderedDictionary();
public OrderedDictionary();
Public Sub New ()
Příklady
Následující příklad kódu ukazuje vytvoření a populaci OrderedDictionary kolekce. Tento kód je součástí většího příkladu kódu, který lze zobrazit na OrderedDictionaryadrese .
// 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)
Poznámky
Porovnávač určuje, zda jsou dva klíče stejné. Každý klíč v kolekci OrderedDictionary musí být jedinečný. Výchozí porovnávač je implementace Object.Equalsklíče .
Platí pro
OrderedDictionary(IEqualityComparer)
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
Inicializuje novou instanci OrderedDictionary třídy pomocí zadaného porovnávače.
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)
Parametry
- comparer
- IEqualityComparer
Slouží IComparer k určení, zda jsou dva klíče stejné.
nebo
null použít výchozí porovnávač, což je implementace každého klíče Equals(Object).
Poznámky
Porovnávač určuje, zda jsou dva klíče stejné. Každý klíč v kolekci OrderedDictionary musí být jedinečný. Výchozí porovnávač je implementace Object.Equalsklíče .
Vlastní porovnávač umožňuje takové scénáře jako vyhledávání s řetězci nerozlišující velká a malá písmena.
Platí pro
OrderedDictionary(Int32)
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
Inicializuje novou instanci OrderedDictionary třídy pomocí zadané počáteční kapacity.
public:
OrderedDictionary(int capacity);
public OrderedDictionary(int capacity);
new System.Collections.Specialized.OrderedDictionary : int -> System.Collections.Specialized.OrderedDictionary
Public Sub New (capacity As Integer)
Parametry
- capacity
- Int32
Počáteční počet prvků, které OrderedDictionary kolekce může obsahovat.
Poznámky
Porovnávač určuje, zda jsou dva klíče stejné. Každý klíč v kolekci OrderedDictionary musí být jedinečný. Výchozí porovnávač je implementace Object.Equalsklíče .
Platí pro
OrderedDictionary(Int32, IEqualityComparer)
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
Inicializuje novou instanci OrderedDictionary třídy pomocí zadané počáteční kapacity a porovnávače.
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)
Parametry
- capacity
- Int32
Počáteční počet prvků, které OrderedDictionary kolekce může obsahovat.
- comparer
- IEqualityComparer
Slouží IComparer k určení, zda jsou dva klíče stejné.
nebo
null použít výchozí porovnávač, což je implementace každého klíče Equals(Object).
Poznámky
Porovnávač určuje, zda jsou dva klíče stejné. Každý klíč v kolekci OrderedDictionary musí být jedinečný. Výchozí porovnávač je implementace Object.Equalsklíče .
Vlastní porovnávač umožňuje takové scénáře jako vyhledávání s řetězci nerozlišující velká a malá písmena.
Platí pro
OrderedDictionary(SerializationInfo, StreamingContext)
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
- Zdroj:
- OrderedDictionary.cs
Upozornění
This API supports obsolete formatter-based serialization. It should not be called or extended by application code.
Inicializuje novou instanci OrderedDictionary třídy, která je serializovatelná pomocí zadané SerializationInfo a StreamingContext objekty.
protected:
OrderedDictionary(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected OrderedDictionary(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
protected OrderedDictionary(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Collections.Specialized.OrderedDictionary : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Collections.Specialized.OrderedDictionary
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)
Parametry
- info
- SerializationInfo
SerializationInfo Objekt obsahující informace potřebné k serializaci OrderedDictionary kolekce.
- context
- StreamingContext
Objekt StreamingContext obsahující zdroj a cíl serializovaného datového proudu přidruženého k objektu OrderedDictionary.
- Atributy
Poznámky
Porovnávač určuje, zda jsou dva klíče stejné. Každý klíč v kolekci OrderedDictionary musí být jedinečný. Výchozí porovnávač je implementace Object.Equalsklíče .