Class Dict<TKey, TValue>
Strongly-typed IDictionary<TKey, TValue> that can be converted to a Dictionary VariantValue.
public sealed class Dict<TKey, TValue> : IDBusWritable, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IVariantValueConvertable where TKey : notnull where TValue : notnull
Type Parameters
TKeyThe type of keys in the dictionary.
TValueThe type of values in the dictionary.
- Inheritance
-
Dict<TKey, TValue>
- Implements
-
IDictionary<TKey, TValue>ICollection<KeyValuePair<TKey, TValue>>IEnumerable<KeyValuePair<TKey, TValue>>
- Inherited Members
Remarks
Supported types for keys and values: byte, bool, short, ushort, int, uint, long, ulong, double, string, ObjectPath, Signature, SafeHandle, VariantValue, Array<T>, Dict<TKey, TValue>, and Struct types.
Constructors
Dict()
Initializes a new instance of the Dict class.
public Dict()
Dict(IDictionary<TKey, TValue>)
Initializes a new instance of the Dict class from an existing dictionary.
public Dict(IDictionary<TKey, TValue> dictionary)
Parameters
dictionaryIDictionary<TKey, TValue>The dictionary to copy elements from.
Properties
Count
public int Count { get; }
Property Value
this[TKey]
public TValue this[TKey key] { get; set; }
Parameters
keyTKey
Property Value
- TValue
Methods
Add(TKey, TValue)
public void Add(TKey key, TValue value)
Parameters
keyTKeyvalueTValue
AsVariantValue()
Converts this instance to a VariantValue.
public VariantValue AsVariantValue()
Returns
- VariantValue
The VariantValue representation of this instance.
Clear()
public void Clear()
ContainsKey(TKey)
public bool ContainsKey(TKey key)
Parameters
keyTKey
Returns
Remove(TKey)
public bool Remove(TKey key)
Parameters
keyTKey
Returns
TryGetValue(TKey, out TValue)
public bool TryGetValue(TKey key, out TValue value)
Parameters
keyTKeyvalueTValue
Returns
Operators
implicit operator VariantValue(Dict<TKey, TValue>)
Implicitly converts a Dict to a VariantValue.
public static implicit operator VariantValue(Dict<TKey, TValue> value)
Parameters
valueDict<TKey, TValue>The dictionary to convert.