Class FlagsAndAttributes<TKey, TValue>
Default implementation of the flags and attributes used in the library.
public class FlagsAndAttributes<TKey, TValue> : BaseDictionary<TKey, TValue?>, IDictionary<TKey, TValue?>, ICollection<KeyValuePair<TKey, TValue?>>, IReadOnlyDictionary<TKey, TValue?>, IReadOnlyCollection<KeyValuePair<TKey, TValue?>>, IEnumerable<KeyValuePair<TKey, TValue?>>, IDictionary, ICollection, IEnumerable, IFlagsAndAttributes<TKey, TValue>, ICustomFlags<TKey>, IReadOnlyFlags<TKey>, ICustomAttributes<TKey, TValue>, IReadOnlyAttributes<TKey, TValue> where TKey : notnull
Type Parameters
TKeyThe type of the identifiers.
TValueThe type of the values.
- Inheritance
-
ConcurrentDictionary<TKey, TValue>BaseDictionary<TKey, TValue>FlagsAndAttributes<TKey, TValue>
- Implements
-
IDictionary<TKey, TValue>ICollection<KeyValuePair<TKey, TValue>>IReadOnlyDictionary<TKey, TValue>IReadOnlyCollection<KeyValuePair<TKey, TValue>>IEnumerable<KeyValuePair<TKey, TValue>>IFlagsAndAttributes<TKey, TValue>ICustomFlags<TKey>IReadOnlyFlags<TKey>ICustomAttributes<TKey, TValue>IReadOnlyAttributes<TKey, TValue>
Properties
- Attr
Gets custom attributes provider.
- Flags
Gets custom flags provider.
Methods
- AddFlag(TKey)
Adds flag with
id.
- GetAttribute(TKey)
Gets attribute value. Returns
nullif there is no such attribute.
- GetAttribute<T2>(TKey)
Gets attribute value as
TKeytype.
- GetAttribute<T2>(TKey, T2)
Gets attribute value as
T2type ordefaultValueif there is no such attribute.
- HasAttribute(TKey)
Attribute with
idwas added.
- HasFlag(TKey)
Flag with
idwas added.
- RemoveAttribute(TKey)
Removes attribute with
id.
- RemoveFlag(TKey)
Removes flag with
id.
- SetAttribute(TKey, TValue?)
Sets attribute value.
- SetAttribute<T2>(TKey, T2?)
Sets attribute value.
- SetFlag(TKey, bool)
Adds flag if
valueis true, removes flag if its false.
- ToggleFlag(TKey)
If flag with
idwas previously added, it is removed. And if there is no such flag, it is added.