CachedSynchronizedPairSet

Ecng.Collections

Represents a thread-safe set of key-value pairs with cached keys, values, and pairs for improved performance.

Наследует: SynchronizedPairSet<T, T>

Конструкторы

CachedSynchronizedPairSet
public CachedSynchronizedPairSet()
cachedSynchronizedPairSet = CachedSynchronizedPairSet()

Initializes a new instance of the CachedSynchronizedPairSet class.

CachedSynchronizedPairSet
public CachedSynchronizedPairSet(IEqualityComparer<TKey> comparer)
cachedSynchronizedPairSet = CachedSynchronizedPairSet(comparer)

Initializes a new instance of the CachedSynchronizedPairSet class with the specified key comparer.

comparer
The equality comparer to use when comparing keys.
CachedSynchronizedPairSet
public CachedSynchronizedPairSet(IEqualityComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer)
cachedSynchronizedPairSet = CachedSynchronizedPairSet(keyComparer, valueComparer)

Initializes a new instance of the CachedSynchronizedPairSet class with the specified key and value comparers.

keyComparer
The equality comparer to use when comparing keys.
valueComparer
The equality comparer to use when comparing values.

Свойства

CachedKeys
public TKey[] CachedKeys { get; }
value = cachedSynchronizedPairSet.CachedKeys

Gets an array of cached keys from the set.

CachedPairs
public KeyValuePair<TKey, TValue>[] CachedPairs { get; }
value = cachedSynchronizedPairSet.CachedPairs

Gets an array of cached key-value pairs from the set.

CachedValues
public TValue[] CachedValues { get; }
value = cachedSynchronizedPairSet.CachedValues

Gets an array of cached values from the set.

Item
public override TValue Item { set; }
cachedSynchronizedPairSet.Item = value

Gets or sets the value associated with the specified key.

key
The key of the value to get or set.

Возвращает: The value associated with the specified key.

Методы

Add
public override void Add(TKey key, TValue value)
cachedSynchronizedPairSet.Add(key, value)

Adds the specified key and value to the set.

key
The key of the element to add.
value
The value of the element to add.
Clear
public override void Clear()
cachedSynchronizedPairSet.Clear()

Removes all keys and values from the set.

OnResetCache
protected virtual void OnResetCache(bool isKey)
cachedSynchronizedPairSet.OnResetCache(isKey)

Resets the cached keys, values, and key-value pairs when the set is modified.

isKey
Indicates whether the cache reset is due to a key modification.
Remove
public override bool Remove(TKey key)
result = cachedSynchronizedPairSet.Remove(key)

Removes the value with the specified key from the set.

key
The key of the element to remove.

Возвращает: true if the element is successfully found and removed; otherwise, false.