Skip to main content

AvaloniaDictionary<TKey, TValue> Class

A notifying dictionary.

Definition

Namespace: Avalonia.Collections
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public class AvaloniaDictionary<TKey, TValue> : IAvaloniaDictionary<TKey, TValue>, 
IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>,
IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IAvaloniaReadOnlyDictionary<TKey, TValue>,
IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>,
INotifyCollectionChanged, INotifyPropertyChanged, IDictionary, ICollection

View Source
InheritanceObject → AvaloniaDictionary(TKey, TValue)
ImplementsIAvaloniaDictionary(TKey, TValue), IAvaloniaReadOnlyDictionary(TKey, TValue), ICollection(KeyValuePair(TKey, TValue)), IDictionary(TKey, TValue), IEnumerable(KeyValuePair(TKey, TValue)), IReadOnlyCollection(KeyValuePair(TKey, TValue)), IReadOnlyDictionary(TKey, TValue), ICollection, IDictionary, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged

Type Parameters

The type of the dictionary key.
The type of the dictionary value.

Constructors

AvaloniaDictionary(TKey, TValue)()Initializes a new instance of the AvaloniaDictionary(TKey, TValue) class.
AvaloniaDictionary(TKey, TValue)(Int32)Initializes a new instance of the AvaloniaDictionary(TKey, TValue) class.

Properties

CountGets the number of elements contained in the ICollection(T).
IsReadOnlyGets a value indicating whether the ICollection(T) is read-only.
Item(TKey)Gets or sets the named resource.
KeysGets an ICollection(T) containing the keys of the IDictionary(TKey, TValue).
ValuesGets an ICollection(T) containing the values in the IDictionary(TKey, TValue).

Methods

Add(TKey, TValue)Adds an element with the provided key and value to the IDictionary(TKey, TValue).
Clear()Removes all items from the ICollection(T).
ContainsKey(TKey)Determines whether the IDictionary(TKey, TValue) contains an element with the specified key.
CopyTo(KeyValuePair(TKey, TValue)[], Int32)Copies the elements of the ICollection(T) to an Array, starting at a particular Array index.
Equals(Object)Determines whether the specified object is equal to the current object.
(Inherited from Object)
Finalize()Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetEnumerator()Returns an enumerator that iterates through the collection.
GetHashCode()Serves as the default hash function.
(Inherited from Object)
GetType()Gets the Type of the current instance.
(Inherited from Object)
MemberwiseClone()Creates a shallow copy of the current Object.
(Inherited from Object)
Remove(TKey)Removes the element with the specified key from the IDictionary(TKey, TValue).
ToString()Returns a string that represents the current object.
(Inherited from Object)
TryGetValue(TKey, TValue)Gets the value associated with the specified key.

Events

CollectionChangedOccurs when the collection changes.
PropertyChangedRaised when a property on the collection changes.

Extension Methods

GetWeakCollectionChangedObservable()Gets a weak observable for the CollectionChanged event.
(Defined by NotifyCollectionChangedExtensions)
WeakSubscribe(Action(NotifyCollectionChangedEventArgs))Subscribes to the CollectionChanged event using a weak subscription.
(Defined by NotifyCollectionChangedExtensions)
WeakSubscribe(NotifyCollectionChangedEventHandler)Subscribes to the CollectionChanged event using a weak subscription.
(Defined by NotifyCollectionChangedExtensions)

See Also

Reference

Avalonia.Collections Namespace