[]
Represents a collection of key/value pairs that are sorted on the key.
public class ObservableSortedDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IDictionary, ICollection, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
TKey
The type of the keys in the dictionary.
TValue
The type of the values in the dictionary.
Initializes a new instance of the ObservableSortedDictionary<TKey, TValue> class.
public ObservableSortedDictionary()
Initializes a new instance of the ObservableSortedDictionary<TKey, TValue> class.
public ObservableSortedDictionary(IComparer<TKey> comparer)
comparer
System.Collections.Generic.IComparer<T><TKey>The underlying System.Collections.Generic.SortedDictionary<TKey, TValue>.
protected readonly SortedDictionary<TKey, TValue> m_Items
Gets a value indicating whether list was changed.
public bool Changed { get; set; }
Gets the number of key/value pairs contained in the System.Collections.Generic.SortedDictionary<TKey, TValue>.
public int Count { get; }
Gets or sets the value associated with the specified key.
public TValue this[TKey key] { get; set; }
key
TKeyThe key of the value to get or set.
Gets a collection containing the keys in the ObservableSortedDictionary<TKey, TValue>.
public ICollection<TKey> Keys { get; }
Gets a collection containing the values in the System.Collections.Generic.SortedDictionary<TKey, TValue>.
public ICollection<TValue> Values { get; }
Adds an element with the specified key and value into the ObservableSortedDictionary<TKey, TValue>.
public void Add(TKey key, TValue value)
key
TKeyThe key of the element to add.
value
TValueThe value of the element to add. The value can be null for reference types.
Adds an element into collection with specified key.
protected virtual void AddItem(TKey key, TValue value)
key
TKeyvalue
TValueRemoves all elements from the ObservableSortedDictionary<TKey, TValue>.
public void Clear()
Removes all elements from the collection.
protected virtual void ClearItems()
Determines whether the ObservableSortedDictionary<TKey, TValue> contains an element with the specified key.
public bool ContainsKey(TKey key)
key
TKeyThe key to locate in the ObservableSortedDictionary<TKey, TValue>.
Called when dictionary was changed, sets Changed to true.
protected virtual void OnChanged()
Removes the element with the specified key from the ObservableSortedDictionary<TKey, TValue>.
public bool Remove(TKey key)
key
TKeyThe key of the element to remove.
Removes an element with specified key.
protected virtual bool RemoveItem(TKey key)
key
TKeyReplaces the element with the specified key.
protected virtual void SetItem(TKey key, TValue value)
key
TKeyvalue
TValueGets the value associated with the specified key.
public bool TryGetValue(TKey key, out TValue value)
key
TKeyThe key of the value to get.
value
TValueWhen this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter.
true if the ObservableSortedDictionary<TKey, TValue> contains an element with the specified key; otherwise, false.