Table of Contents

Class Dict<TKey, TValue>

Namespace
Tmds.DBus.Protocol
Assembly
Tmds.DBus.Protocol.dll

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

TKey

The type of keys in the dictionary.

TValue

The 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

dictionary IDictionary<TKey, TValue>

The dictionary to copy elements from.

Properties

Count

public int Count { get; }

Property Value

int

this[TKey]

public TValue this[TKey key] { get; set; }

Parameters

key TKey

Property Value

TValue

Methods

Add(TKey, TValue)

public void Add(TKey key, TValue value)

Parameters

key TKey
value TValue

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

key TKey

Returns

bool

Remove(TKey)

public bool Remove(TKey key)

Parameters

key TKey

Returns

bool

TryGetValue(TKey, out TValue)

public bool TryGetValue(TKey key, out TValue value)

Parameters

key TKey
value TValue

Returns

bool

Operators

implicit operator VariantValue(Dict<TKey, TValue>)

Implicitly converts a Dict to a VariantValue.

public static implicit operator VariantValue(Dict<TKey, TValue> value)

Parameters

value Dict<TKey, TValue>

The dictionary to convert.

Returns

VariantValue