Table of Contents

Class AdvDictionaryCached<TKey, TValue>

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Implements dictionary with GetValueOrDefaultCached(TKey, TValue) and GetOrCreateCached(TKey, Func<TValue>) methods. These methods speed up work with dictionary if same item is accessed more than once continiously.

public class AdvDictionaryCached<TKey, TValue> : AdvDictionary<TKey, TValue>, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IDictionary, ICollection, IEnumerable, IDeserializationCallback, ISerializable where TKey : notnull

Type Parameters

TKey

The type of the keys in the dictionary.

TValue

The type of the values in the dictionary.

Inheritance
Dictionary<TKey, TValue>
AdvDictionary<TKey, TValue>
AdvDictionaryCached<TKey, TValue>
Implements
IDictionary<TKey, TValue>
ICollection<KeyValuePair<TKey, TValue>>
IReadOnlyDictionary<TKey, TValue>
IEnumerable<KeyValuePair<TKey, TValue>>

Properties

LastItem

Gets last used item in GetOrCreateCached(TKey, Func<TValue>) method.

Methods

Clear()

Removes all keys and values from the dictionary.

GetOrCreateCached(TKey, Func<TValue>)

Gets the value associated with the specified key. If the key is not found in the dictionary, it is added there with the value provided by func.

GetValueOrDefaultCached(TKey, TValue)

Gets the value associated with the specified key. Returns defaultValue if the key is not found.

Remove(TKey)

Removes the value with the specified key from the dictionary.