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
TKeyThe type of keys in the collection.
TValueThe type of values in the collection.
- Inheritance
-
KeyedCollection<TKey, TValue>SynchronizedKeyedCollection<TKey, TValue>
- Implements
-
IDictionary<TKey, TValue>ISynchronizedCollection<KeyValuePair<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
comparerIEqualityComparer<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
keyTKeyThe 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
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
keyTKeyThe key of the element to remove.
Returns
- bool
trueif the element is successfully found and removed; otherwise,false.