[]
        
(Showing Draft Content)

GrapeCity.Documents.Common.ObservableSortedDictionary-2

Class ObservableSortedDictionary<TKey, TValue>

Namespace
GrapeCity.Documents.Common
Assembly
GcDocs.Imaging.dll

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

Type Parameters

TKey

The type of the keys in the dictionary.

TValue

The type of the values in the dictionary.

Inheritance
object
ObservableSortedDictionary<TKey, TValue>
Implements
System.Collections.Generic.IDictionary<TKey, TValue><TKey, TValue>
System.Collections.Generic.ICollection<T><KeyValuePair<TKey, TValue>>
System.Collections.IDictionary
System.Collections.ICollection
System.Collections.Generic.IReadOnlyDictionary<TKey, TValue><TKey, TValue>
System.Collections.Generic.IReadOnlyCollection<T><KeyValuePair<TKey, TValue>>
System.Collections.Generic.IEnumerable<T><KeyValuePair<TKey, TValue>>
System.Collections.IEnumerable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

ObservableSortedDictionary()

Initializes a new instance of the ObservableSortedDictionary<TKey, TValue> class.

public ObservableSortedDictionary()

ObservableSortedDictionary(IComparer<TKey>)

Initializes a new instance of the ObservableSortedDictionary<TKey, TValue> class.

public ObservableSortedDictionary(IComparer<TKey> comparer)

Parameters

comparer System.Collections.Generic.IComparer<T><TKey>

Fields

m_Items

The underlying System.Collections.Generic.SortedDictionary<TKey, TValue>.

protected readonly SortedDictionary<TKey, TValue> m_Items

Field Value

System.Collections.Generic.SortedDictionary<TKey, TValue><TKey, TValue>

Properties

Changed

Gets a value indicating whether list was changed.

public bool Changed { get; set; }

Property Value

bool

Count

Gets the number of key/value pairs contained in the System.Collections.Generic.SortedDictionary<TKey, TValue>.

public int Count { get; }

Property Value

int

this[TKey]

Gets or sets the value associated with the specified key.

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

Parameters

key TKey

The key of the value to get or set.

Property Value

TValue

Keys

Gets a collection containing the keys in the ObservableSortedDictionary<TKey, TValue>.

public ICollection<TKey> Keys { get; }

Property Value

System.Collections.Generic.ICollection<T><TKey>

Values

Gets a collection containing the values in the System.Collections.Generic.SortedDictionary<TKey, TValue>.

public ICollection<TValue> Values { get; }

Property Value

System.Collections.Generic.ICollection<T><TValue>

Methods

Add(TKey, TValue)

Adds an element with the specified key and value into the ObservableSortedDictionary<TKey, TValue>.

public void Add(TKey key, TValue value)

Parameters

key TKey

The key of the element to add.

value TValue

The value of the element to add. The value can be null for reference types.

AddItem(TKey, TValue)

Adds an element into collection with specified key.

protected virtual void AddItem(TKey key, TValue value)

Parameters

key TKey
value TValue

Clear()

Removes all elements from the ObservableSortedDictionary<TKey, TValue>.

public void Clear()

ClearItems()

Removes all elements from the collection.

protected virtual void ClearItems()

ContainsKey(TKey)

Determines whether the ObservableSortedDictionary<TKey, TValue> contains an element with the specified key.

public bool ContainsKey(TKey key)

Parameters

key TKey

The key to locate in the ObservableSortedDictionary<TKey, TValue>.

Returns

bool

OnChanged()

Called when dictionary was changed, sets Changed to true.

protected virtual void OnChanged()

Remove(TKey)

Removes the element with the specified key from the ObservableSortedDictionary<TKey, TValue>.

public bool Remove(TKey key)

Parameters

key TKey

The key of the element to remove.

Returns

bool

RemoveItem(TKey)

Removes an element with specified key.

protected virtual bool RemoveItem(TKey key)

Parameters

key TKey

Returns

bool

SetItem(TKey, TValue)

Replaces the element with the specified key.

protected virtual void SetItem(TKey key, TValue value)

Parameters

key TKey
value TValue

TryGetValue(TKey, out TValue)

Gets the value associated with the specified key.

public bool TryGetValue(TKey key, out TValue value)

Parameters

key TKey

The key of the value to get.

value TValue

When 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.

Returns

bool

true if the ObservableSortedDictionary<TKey, TValue> contains an element with the specified key; otherwise, false.