ConcurrentDictionary<TKey,TValue> Konstruktorer
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen.
Överlagringar
| Name | Description |
|---|---|
| ConcurrentDictionary<TKey,TValue>() |
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som är tom, har standardnivån samtidighet, har standardinitieringskapaciteten och använder standardjämeraren för nyckeltypen. |
| ConcurrentDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>) |
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som innehåller element som kopierats från den angivna IEnumerable<T>, har standardkonkurrencynivån, har standardinitieringskapaciteten och använder standardjäxaren för nyckeltypen. |
| ConcurrentDictionary<TKey,TValue>(IEqualityComparer<TKey>) |
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som är tom, har standardnivån för samtidighet och kapacitet och använder den angivna IEqualityComparer<T>. |
| ConcurrentDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>) |
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som innehåller element som kopierats från den angivna IEnumerable har standardkonkurrencynivån, har standardinitieringskapaciteten och använder den angivna IEqualityComparer<T>. |
| ConcurrentDictionary<TKey,TValue>(Int32, Int32) |
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som är tom, har den angivna samtidighetsnivån och kapaciteten och använder standardjämeraren för nyckeltypen. |
| ConcurrentDictionary<TKey,TValue>(Int32, IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>) |
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som innehåller element som kopierats från den angivna IEnumerableoch använder den angivna IEqualityComparer<T>. |
| ConcurrentDictionary<TKey,TValue>(Int32, Int32, IEqualityComparer<TKey>) |
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som är tom, har den angivna samtidighetsnivån, har den angivna initiala kapaciteten och använder den angivna IEqualityComparer<T>. |
ConcurrentDictionary<TKey,TValue>()
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som är tom, har standardnivån samtidighet, har standardinitieringskapaciteten och använder standardjämeraren för nyckeltypen.
public:
ConcurrentDictionary();
public ConcurrentDictionary();
Public Sub New ()
Kommentarer
Standardkonkurrensnivån är lika med antalet processorer. Ju högre samtidighetsnivå är, desto fler samtidiga skrivåtgärder kan utföras utan interferens och blockering. Högre värden på samtidighetsnivå gör också att åtgärder som kräver alla lås (till exempel storleksändring ToArray av tabeller och Count) blir dyrare. Standardkapaciteten (DEFAULT_CAPACITY), som representerar det inledande antalet bucketar, är en kompromiss mellan storleken på en mycket liten ordlista och antalet storleksändringar när du skapar en stor ordlista. Dessutom bör kapaciteten inte vara delbar med ett litet primtal. Standardkapaciteten är 31.
Se även
Gäller för
ConcurrentDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>)
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som innehåller element som kopierats från den angivna IEnumerable<T>, har standardkonkurrencynivån, har standardinitieringskapaciteten och använder standardjäxaren för nyckeltypen.
public:
ConcurrentDictionary(System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<TKey, TValue>> ^ collection);
public ConcurrentDictionary(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> collection);
new System.Collections.Concurrent.ConcurrentDictionary<'Key, 'Value> : seq<System.Collections.Generic.KeyValuePair<'Key, 'Value>> -> System.Collections.Concurrent.ConcurrentDictionary<'Key, 'Value>
Public Sub New (collection As IEnumerable(Of KeyValuePair(Of TKey, TValue)))
Parametrar
- collection
- IEnumerable<KeyValuePair<TKey,TValue>>
Vars IEnumerable<T> element kopieras till den nya ConcurrentDictionary<TKey,TValue>.
Undantag
collection eller någon av dess nycklar är null.
collection innehåller en eller flera dubblettnycklar.
Se även
Gäller för
ConcurrentDictionary<TKey,TValue>(IEqualityComparer<TKey>)
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som är tom, har standardnivån för samtidighet och kapacitet och använder den angivna IEqualityComparer<T>.
public:
ConcurrentDictionary(System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public ConcurrentDictionary(System.Collections.Generic.IEqualityComparer<TKey> comparer);
new System.Collections.Concurrent.ConcurrentDictionary<'Key, 'Value> : System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Concurrent.ConcurrentDictionary<'Key, 'Value>
Public Sub New (comparer As IEqualityComparer(Of TKey))
Parametrar
- comparer
- IEqualityComparer<TKey>
Likhetsjämförelseimplementeringen som ska användas vid jämförelse av nycklar.
Undantag
comparer är null.
Se även
Gäller för
ConcurrentDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>)
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som innehåller element som kopierats från den angivna IEnumerable har standardkonkurrencynivån, har standardinitieringskapaciteten och använder den angivna IEqualityComparer<T>.
public:
ConcurrentDictionary(System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<TKey, TValue>> ^ collection, System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public ConcurrentDictionary(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> collection, System.Collections.Generic.IEqualityComparer<TKey> comparer);
new System.Collections.Concurrent.ConcurrentDictionary<'Key, 'Value> : seq<System.Collections.Generic.KeyValuePair<'Key, 'Value>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Concurrent.ConcurrentDictionary<'Key, 'Value>
Public Sub New (collection As IEnumerable(Of KeyValuePair(Of TKey, TValue)), comparer As IEqualityComparer(Of TKey))
Parametrar
- collection
- IEnumerable<KeyValuePair<TKey,TValue>>
Vars IEnumerable<T> element kopieras till den nya ConcurrentDictionary<TKey,TValue>.
- comparer
- IEqualityComparer<TKey>
Den IEqualityComparer<T> implementering som ska användas vid jämförelse av nycklar.
Undantag
collection eller comparer är null.
Se även
Gäller för
ConcurrentDictionary<TKey,TValue>(Int32, Int32)
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som är tom, har den angivna samtidighetsnivån och kapaciteten och använder standardjämeraren för nyckeltypen.
public:
ConcurrentDictionary(int concurrencyLevel, int capacity);
public ConcurrentDictionary(int concurrencyLevel, int capacity);
new System.Collections.Concurrent.ConcurrentDictionary<'Key, 'Value> : int * int -> System.Collections.Concurrent.ConcurrentDictionary<'Key, 'Value>
Public Sub New (concurrencyLevel As Integer, capacity As Integer)
Parametrar
- concurrencyLevel
- Int32
Det uppskattade antalet trådar som uppdaterar ConcurrentDictionary<TKey,TValue> samtidigt, eller endast i .NET 8+ -1 för att ange standardkonkursensnivå.
- capacity
- Int32
Det inledande antalet element som ConcurrentDictionary<TKey,TValue> kan innehålla.
Undantag
Se även
Gäller för
ConcurrentDictionary<TKey,TValue>(Int32, IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>)
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som innehåller element som kopierats från den angivna IEnumerableoch använder den angivna IEqualityComparer<T>.
public:
ConcurrentDictionary(int concurrencyLevel, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<TKey, TValue>> ^ collection, System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public ConcurrentDictionary(int concurrencyLevel, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> collection, System.Collections.Generic.IEqualityComparer<TKey> comparer);
new System.Collections.Concurrent.ConcurrentDictionary<'Key, 'Value> : int * seq<System.Collections.Generic.KeyValuePair<'Key, 'Value>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Concurrent.ConcurrentDictionary<'Key, 'Value>
Public Sub New (concurrencyLevel As Integer, collection As IEnumerable(Of KeyValuePair(Of TKey, TValue)), comparer As IEqualityComparer(Of TKey))
Parametrar
- concurrencyLevel
- Int32
Det uppskattade antalet trådar som uppdaterar ConcurrentDictionary<TKey,TValue> samtidigt, eller endast i .NET 8+ -1 för att ange standardkonkursensnivå.
- collection
- IEnumerable<KeyValuePair<TKey,TValue>>
Vars IEnumerable<T> element kopieras till den nya ConcurrentDictionary<TKey,TValue>.
- comparer
- IEqualityComparer<TKey>
Den IEqualityComparer<T> implementering som ska användas vid jämförelse av nycklar.
Undantag
collection eller comparer är null.
concurrencyLevel är mindre än 1.
collection innehåller en eller flera dubblettnycklar.
Se även
Gäller för
ConcurrentDictionary<TKey,TValue>(Int32, Int32, IEqualityComparer<TKey>)
Initierar en ny instans av ConcurrentDictionary<TKey,TValue> klassen som är tom, har den angivna samtidighetsnivån, har den angivna initiala kapaciteten och använder den angivna IEqualityComparer<T>.
public:
ConcurrentDictionary(int concurrencyLevel, int capacity, System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public ConcurrentDictionary(int concurrencyLevel, int capacity, System.Collections.Generic.IEqualityComparer<TKey> comparer);
new System.Collections.Concurrent.ConcurrentDictionary<'Key, 'Value> : int * int * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Concurrent.ConcurrentDictionary<'Key, 'Value>
Public Sub New (concurrencyLevel As Integer, capacity As Integer, comparer As IEqualityComparer(Of TKey))
Parametrar
- concurrencyLevel
- Int32
Det uppskattade antalet trådar som uppdaterar ConcurrentDictionary<TKey,TValue> samtidigt, eller endast i .NET 8+ -1 för att ange standardkonkursensnivå.
- capacity
- Int32
Det inledande antalet element som ConcurrentDictionary<TKey,TValue> kan innehålla.
- comparer
- IEqualityComparer<TKey>
Den IEqualityComparer<T> implementering som ska användas vid jämförelse av nycklar.
Undantag
comparer är null.
concurrencyLevel eller capacity är mindre än 1.