Skip to main content

Class ObservableDictionary<TKey, TValue>

Provides a dictionary for use with data binding.

Assembly: Meadow.dll
View Source
Declaration
public class ObservableDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged

Implements:
System.Collections.Generic.IDictionary<<TKey>,<TValue>>, System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<<TKey>,<TValue>>>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<<TKey>,<TValue>>>, System.Collections.IEnumerable, System.Collections.Specialized.INotifyCollectionChanged, System.ComponentModel.INotifyPropertyChanged

Properties

Keys

Gets an System.Collections.Generic.ICollection%601 containing the keys of the System.Collections.Generic.IDictionary%602.

View Source
Declaration
public ICollection<TKey> Keys { get; }

Values

Gets an System.Collections.Generic.ICollection%601 containing the values in the System.Collections.Generic.IDictionary%602.

View Source
Declaration
public ICollection<TValue> Values { get; }

this[TKey]

Gets or sets the element with the specified key.

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

Methods

RaisePropertyChanged(PropertyChangedEventArgs)

Allows derived classes to raise custom property changed events.

View Source
Declaration
protected void RaisePropertyChanged(PropertyChangedEventArgs args)
Parameters
TypeName
System.ComponentModel.PropertyChangedEventArgsargs

Add(TKey, TValue)

Adds an element with the provided key and value to the System.Collections.Generic.IDictionary%602.

View Source
Declaration
public void Add(TKey key, TValue value)
Parameters
TypeNameDescription
<TKey>keyThe object to use as the key of the element to add.
<TValue>valueThe object to use as the value of the element to add.

ContainsKey(TKey)

Determines whether the System.Collections.Generic.IDictionary%602 contains an element with the specified key.

View Source
Declaration
public bool ContainsKey(TKey key)
Returns

System.Boolean: true if the System.Collections.Generic.IDictionary%602 contains an element with the key; otherwise, false.

Parameters
TypeNameDescription
<TKey>keyThe key to locate in the System.Collections.Generic.IDictionary%602.

Remove(TKey)

Removes the element with the specified key from the System.Collections.Generic.IDictionary%602.

View Source
Declaration
public bool Remove(TKey key)
Returns

System.Boolean: true if the element is successfully removed; otherwise, false. This method also returns false if <code class="paramref">key</code> was not found in the original System.Collections.Generic.IDictionary%602.

Parameters
TypeNameDescription
<TKey>keyThe key of the element to remove.

TryGetValue(TKey, out TValue)

Gets the value associated with the specified key.

View Source
Declaration
public bool TryGetValue(TKey key, out TValue value)
Returns

System.Boolean: true if the object that implements System.Collections.Generic.IDictionary%602 contains an element with the specified key; otherwise, false.

Parameters
TypeNameDescription
<TKey>keyThe key whose value to get.
<TValue>valueWhen this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the <code class="paramref">value</code> parameter. This parameter is passed uninitialized.

GetEnumerator()

Returns an enumerator that iterates through a collection.

View Source
Declaration
public IEnumerator GetEnumerator()
Returns

System.Collections.IEnumerator: An System.Collections.IEnumerator object that can be used to iterate through the collection.## Events

CollectionChanged

Event raised when the collection changes.

View Source
Declaration
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Type

System.Collections.Specialized.NotifyCollectionChangedEventHandler

PropertyChanged

Event raised when a property on the collection changes.

View Source
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type

System.ComponentModel.PropertyChangedEventHandler

Implements

  • System.Collections.Generic.IDictionary<<TKey>,<TValue>>
  • System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<<TKey>,<TValue>>>
  • System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<<TKey>,<TValue>>>
  • System.Collections.IEnumerable
  • System.Collections.Specialized.INotifyCollectionChanged
  • System.ComponentModel.INotifyPropertyChanged

Extension Methods

  • System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{0,1}}.Meadow.ExtensionMethods.Contains``1(System.Collections.Generic.KeyValuePair{{TKey},{TValue}}[])
  • System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{0,1}}.Meadow.ExtensionMethods.FirstIndexOf``1(System.Collections.Generic.KeyValuePair{{TKey},{TValue}}[])