[]
        
(Showing Draft Content)

GrapeCity.Documents.Common.ObservableSortedList-2

Class ObservableSortedList<TKey, TValue>

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

The System.Collections.Generic.SortedList<TKey, TValue> supporting GrapeCity.Documents.Common.IObservableCollectionEx interface.

public class ObservableSortedList<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IDictionary, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IList, ICollection, IEnumerable

Type Parameters

TKey

The type of the keys in the dictionary.

TValue

The type of the values in the dictionary.

Inheritance
object
ObservableSortedList<TKey, TValue>
Implements
System.Collections.Generic.IDictionary<TKey, TValue><TKey, TValue>
System.Collections.Generic.ICollection<T><KeyValuePair<TKey, TValue>>
System.Collections.IDictionary
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.IList
System.Collections.ICollection
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

ObservableSortedList()

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

public ObservableSortedList()

ObservableSortedList(IComparer<TKey>)

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

public ObservableSortedList(IComparer<TKey> comparer)

Parameters

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

Fields

m_Items

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

protected readonly SortedList<TKey, TValue> m_Items

Field Value

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

Properties

Changed

Gets a value indicating whether the 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 IList<TKey> Keys { get; }

Property Value

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

Values

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

public IList<TValue> Values { get; }

Property Value

System.Collections.Generic.IList<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.

Events

ListChanged

Raised when the list is changed.

public event EventHandler ListChanged

Event Type

System.EventHandler