Bewerken

Delen via


SynchronizedKeyedCollection<K,T> Constructors

Definition

Initializes a new instance of the SynchronizedKeyedCollection<K,T> class.

Overloads

SynchronizedKeyedCollection<K,T>()

Initializes a new instance of the SynchronizedKeyedCollection<K,T> class.

SynchronizedKeyedCollection<K,T>(Object)

Initializes a new instance of the SynchronizedKeyedCollection<K,T> class with access synchronized by an explicitly specified object.

SynchronizedKeyedCollection<K,T>(Object, IEqualityComparer<K>)

Initializes a new instance of the SynchronizedKeyedCollection<K,T> class with access synchronized by an explicitly specified object and with keys compared in a specified way.

SynchronizedKeyedCollection<K,T>(Object, IEqualityComparer<K>, Int32)

Initializes a new instance of the SynchronizedKeyedCollection<K,T> class with access synchronized by an explicitly specified object and with keys compared in a specified way.

SynchronizedKeyedCollection<K,T>()

Source:
SynchronizedKeyedCollection.cs
Source:
SynchronizedKeyedCollection.cs

Initializes a new instance of the SynchronizedKeyedCollection<K,T> class.

protected:
 SynchronizedKeyedCollection();
protected SynchronizedKeyedCollection ();
Protected Sub New ()

Applies to

SynchronizedKeyedCollection<K,T>(Object)

Source:
SynchronizedKeyedCollection.cs
Source:
SynchronizedKeyedCollection.cs

Initializes a new instance of the SynchronizedKeyedCollection<K,T> class with access synchronized by an explicitly specified object.

protected:
 SynchronizedKeyedCollection(System::Object ^ syncRoot);
protected SynchronizedKeyedCollection (object syncRoot);
new System.Collections.Generic.SynchronizedKeyedCollection<'K, 'T> : obj -> System.Collections.Generic.SynchronizedKeyedCollection<'K, 'T>
Protected Sub New (syncRoot As Object)

Parameters

syncRoot
Object

The object used to synchronize access to the thread-safe collection.

Exceptions

syncRoot is null.

Remarks

If multiple instances of the SynchronizedKeyedCollection<K,T> are created using the same syncRoot, then access is protected across all instances.

Applies to

SynchronizedKeyedCollection<K,T>(Object, IEqualityComparer<K>)

Source:
SynchronizedKeyedCollection.cs
Source:
SynchronizedKeyedCollection.cs

Initializes a new instance of the SynchronizedKeyedCollection<K,T> class with access synchronized by an explicitly specified object and with keys compared in a specified way.

protected:
 SynchronizedKeyedCollection(System::Object ^ syncRoot, System::Collections::Generic::IEqualityComparer<K> ^ comparer);
protected SynchronizedKeyedCollection (object syncRoot, System.Collections.Generic.IEqualityComparer<K> comparer);
new System.Collections.Generic.SynchronizedKeyedCollection<'K, 'T> : obj * System.Collections.Generic.IEqualityComparer<'K> -> System.Collections.Generic.SynchronizedKeyedCollection<'K, 'T>
Protected Sub New (syncRoot As Object, comparer As IEqualityComparer(Of K))

Parameters

syncRoot
Object

The object used to synchronize access to the thread-safe collection.

comparer
IEqualityComparer<K>

The IEqualityComparer<T> of type K used to compare key objects of type K for equality.

Exceptions

syncRoot is null or comparer is null.

Remarks

The generic parameter K used by the IEqualityComparer<T> input parameter is the first generic parameter for this class. This allows us to compare keys for equality in a customized way that can be used, for example, to optimize on the most critical aspects of the comparison.

Applies to

SynchronizedKeyedCollection<K,T>(Object, IEqualityComparer<K>, Int32)

Source:
SynchronizedKeyedCollection.cs
Source:
SynchronizedKeyedCollection.cs

Initializes a new instance of the SynchronizedKeyedCollection<K,T> class with access synchronized by an explicitly specified object and with keys compared in a specified way.

protected:
 SynchronizedKeyedCollection(System::Object ^ syncRoot, System::Collections::Generic::IEqualityComparer<K> ^ comparer, int dictionaryCreationThreshold);
protected SynchronizedKeyedCollection (object syncRoot, System.Collections.Generic.IEqualityComparer<K> comparer, int dictionaryCreationThreshold);
new System.Collections.Generic.SynchronizedKeyedCollection<'K, 'T> : obj * System.Collections.Generic.IEqualityComparer<'K> * int -> System.Collections.Generic.SynchronizedKeyedCollection<'K, 'T>
Protected Sub New (syncRoot As Object, comparer As IEqualityComparer(Of K), dictionaryCreationThreshold As Integer)

Parameters

syncRoot
Object

The object used to synchronize access to the thread-safe collection.

comparer
IEqualityComparer<K>

The IEqualityComparer<T> of type K used to compare key objects of type K for equality.

dictionaryCreationThreshold
Int32

The number of items required to create a dictionary for the collection.

Exceptions

syncRoot is null or comparer is null.

dictionaryCreationThreshold is less than -1.

Remarks

Setting dictionaryCreationThreshold to -1 assigns the MaxValue (2,147,483,647; hexadecimal 0x7FFFFFFF) to it.

Applies to