Table of Contents

Class SynchronizedKeyedCollection<TKey, TValue>

Namespace
Ecng.Collections
Assembly
Ecng.Collections.dll

Represents a thread-safe keyed collection that provides synchronization for its operations.

public abstract class SynchronizedKeyedCollection<TKey, TValue> : KeyedCollection<TKey, TValue>, IDictionary<TKey, TValue>, ISynchronizedCollection<KeyValuePair<TKey, TValue>>, ISynchronizedCollection, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable

Type Parameters

TKey

The type of keys in the collection.

TValue

The type of values in the collection.

Inheritance
KeyedCollection<TKey, TValue>
SynchronizedKeyedCollection<TKey, TValue>
Implements
IDictionary<TKey, TValue>
ICollection<KeyValuePair<TKey, TValue>>
IEnumerable<KeyValuePair<TKey, TValue>>
Derived
Inherited Members
Extension Methods

Constructors

SynchronizedKeyedCollection()

Initializes a new instance of the SynchronizedKeyedCollection<TKey, TValue> class.

protected SynchronizedKeyedCollection()

SynchronizedKeyedCollection(IEqualityComparer<TKey>)

Initializes a new instance of the SynchronizedKeyedCollection<TKey, TValue> class with the specified equality comparer.

protected SynchronizedKeyedCollection(IEqualityComparer<TKey> comparer)

Parameters

comparer IEqualityComparer<TKey>

The equality comparer to use when comparing keys.

Properties

this[TKey]

Gets or sets the value associated with the specified key.

public override TValue this[TKey key] { set; }

Parameters

key TKey

The key of the value to get or set.

Property Value

TValue

The value associated with the specified key.

SyncRoot

Gets the synchronization root object used to synchronize access to the collection.

public SyncObject SyncRoot { get; }

Property Value

SyncObject

Methods

Clear()

Removes all keys and values from the collection.

public override void Clear()

Remove(TKey)

Removes the value with the specified key from the collection.

public override bool Remove(TKey key)

Parameters

key TKey

The key of the element to remove.

Returns

bool

true if the element is successfully found and removed; otherwise, false.