CachedSynchronizedOrderedDictionary
Represents a thread-safe ordered dictionary with cached keys, values, and key-value pairs for improved performance.
Herda de: SynchronizedOrderedDictionary<T, T>
Construtores
public CachedSynchronizedOrderedDictionary()
cachedSynchronizedOrderedDictionary = CachedSynchronizedOrderedDictionary()
Initializes a new instance of the CachedSynchronizedOrderedDictionary class.
public CachedSynchronizedOrderedDictionary(IComparer<TKey> comparer)
cachedSynchronizedOrderedDictionary = CachedSynchronizedOrderedDictionary(comparer)
Initializes a new instance of the CachedSynchronizedOrderedDictionary class with the specified key comparer.
- comparer
- The comparer to use when comparing keys.
public CachedSynchronizedOrderedDictionary(Func<TKey, TKey, int> comparer)
cachedSynchronizedOrderedDictionary = CachedSynchronizedOrderedDictionary(comparer)
Initializes a new instance of the CachedSynchronizedOrderedDictionary class with the specified key comparison function.
- comparer
- The function to use when comparing keys.
Propriedades
public TKey[] CachedKeys { get; }
value = cachedSynchronizedOrderedDictionary.CachedKeys
Gets an array of cached keys from the dictionary.
public KeyValuePair<TKey, TValue>[] CachedPairs { get; }
value = cachedSynchronizedOrderedDictionary.CachedPairs
Gets an array of cached key-value pairs from the dictionary.
public TValue[] CachedValues { get; }
value = cachedSynchronizedOrderedDictionary.CachedValues
Gets an array of cached values from the dictionary.
public override TValue Item { set; }
cachedSynchronizedOrderedDictionary.Item = value
Gets or sets the value associated with the specified key.
- key
- The key of the value to get or set.
Retorna: The value associated with the specified key.
Métodos
public override void Add(TKey key, TValue value)
cachedSynchronizedOrderedDictionary.Add(key, value)
Adds the specified key and value to the dictionary.
- key
- The key of the element to add.
- value
- The value of the element to add.
public override void Clear()
cachedSynchronizedOrderedDictionary.Clear()
Removes all keys and values from the dictionary.
protected virtual void OnResetCache(bool isKey)
cachedSynchronizedOrderedDictionary.OnResetCache(isKey)
Resets the cached keys, values, and key-value pairs when the dictionary is modified.
- isKey
- Indicates whether the cache reset is due to a key modification.
public override bool Remove(TKey key)
result = cachedSynchronizedOrderedDictionary.Remove(key)
Removes the value with the specified key from the dictionary.
- key
- The key of the element to remove.
Retorna: true if the element is successfully found and removed; otherwise, false.