Show / Hide Table of Contents

Class ObservableDictionary<TKey, TValue>

Implements an Observable dictionary of key value pairs..

Inheritance
System.Object
ObservableDictionary<TKey, TValue>
Implements
IReadOnlyDictionary<TKey, TValue>
ICollection<KeyValuePair<TKey, TValue>>
IReadOnlyCollection<KeyValuePair<TKey, TValue>>
IDictionary
IEnumerable<KeyValuePair<TKey, TValue>>
ICollection
IEnumerable
IAtomProvider
Namespace: Cortex.Net.Types
Assembly: Cortex.Net.dll
Syntax
public sealed class ObservableDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IReadOnlyDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IDictionary, IEnumerable<KeyValuePair<TKey, TValue>>, ICollection, IEnumerable, IAtomProvider
Type Parameters
Name Description
TKey

The type of the keys in the dictionary.

TValue

The type of the values in the dictionary.

Constructors

| Improve this Doc View Source

ObservableDictionary(ISharedState, IEnhancer, IDictionary<TKey, TValue>, String)

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

Declaration
public ObservableDictionary(ISharedState sharedState, IEnhancer enhancer, IDictionary<TKey, TValue> initialValues, string name = null)
Parameters
Type Name Description
ISharedState sharedState

The ISharedState instance this observableDictionary belongs to.

IEnhancer enhancer

The IEnhancer implementation to use.

IDictionary<TKey, TValue> initialValues

The initial values.

System.String name

The name of the ObservableDictionary.

| Improve this Doc View Source

ObservableDictionary(ISharedState, IEnhancer, String)

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

Declaration
public ObservableDictionary(ISharedState sharedState, IEnhancer enhancer, string name = null)
Parameters
Type Name Description
ISharedState sharedState

The ISharedState instance this observableDictionary belongs to.

IEnhancer enhancer

The IEnhancer implementation to use.

System.String name

The name of the ObservableDictionary.

Properties

| Improve this Doc View Source

Count

Gets the number of elements contained in the ObservableDictionary<TKey, TValue>.

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

IsFixedSize

Gets a value indicating whether the ObservableDictionary<TKey, TValue> has a fixed size.

Declaration
public bool IsFixedSize { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsReadOnly

Gets a value indicating whether the ObservableDictionary<TKey, TValue> is read-only.

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsSynchronized

Gets a value indicating whether access to the ObservableDictionary<TKey, TValue> is synchronized (thread safe).

Declaration
public bool IsSynchronized { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Item[TKey]

Gets or sets the value associated with the specified key.

Declaration
public TValue this[TKey key] { get; set; }
Parameters
Type Name Description
TKey key

The key of the value to get or set.

Property Value
Type Description
TValue

The value associated with the specified key. If the specified key is not found, a get operation throws a System.Collections.Generic.KeyNotFoundException, and a set operation creates a new element with the specified key.

| Improve this Doc View Source

Keys

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

Declaration
public ICollection<TKey> Keys { get; }
Property Value
Type Description
ICollection<TKey>
| Improve this Doc View Source

Name

Gets the name of the ObservableDictionary<TKey, TValue>.

Declaration
public string Name { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

SharedState

Gets the shared state this ObservableDictionary<TKey, TValue> operates on.

Declaration
public ISharedState SharedState { get; }
Property Value
Type Description
ISharedState
| Improve this Doc View Source

SyncRoot

Gets an object that can be used to synchronize access to the ObservableDictionary<TKey, TValue>.

Declaration
public object SyncRoot { get; }
Property Value
Type Description
System.Object
| Improve this Doc View Source

Values

Gets a collection containing the values in the ObservableDictionary<TKey, TValue>.

Declaration
public ICollection<TValue> Values { get; }
Property Value
Type Description
ICollection<TValue>

Methods

| Improve this Doc View Source

Add(TKey, TValue)

Adds the specified key and value to the dictionary.

Declaration
public void Add(TKey key, TValue value)
Parameters
Type Name Description
TKey key

The key of the element to add.

TValue value

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

| Improve this Doc View Source

Add(KeyValuePair<TKey, TValue>)

Adds the specified to the dictionary.

Declaration
public void Add(KeyValuePair<TKey, TValue> item)
Parameters
Type Name Description
KeyValuePair<TKey, TValue> item

The pair to add.

| Improve this Doc View Source

Clear()

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

Declaration
public void Clear()
| Improve this Doc View Source

Contains(KeyValuePair<TKey, TValue>)

Determines whether the System.Collections.Generic.Dictionary`2 contains the specified key value pair.

Declaration
public bool Contains(KeyValuePair<TKey, TValue> item)
Parameters
Type Name Description
KeyValuePair<TKey, TValue> item

The to locate in the System.Collections.Generic.Dictionary`2.

Returns
Type Description
System.Boolean

true if the System.Collections.Generic.Dictionary`2 contains the key value pair; otherwise, false.

| Improve this Doc View Source

ContainsKey(TKey)

Determines whether the System.Collections.Generic.Dictionary`2 contains the specified key.

Declaration
public bool ContainsKey(TKey key)
Parameters
Type Name Description
TKey key

The key to locate in the System.Collections.Generic.Dictionary`2.

Returns
Type Description
System.Boolean

true if the System.Collections.Generic.Dictionary`2 contains an element with the specified key; otherwise, false.

| Improve this Doc View Source

CopyTo(KeyValuePair<TKey, TValue>[], Int32)

Copies the elements of the ObservableDictionary<TKey, TValue> to an System.Array, starting at a particular System.Array index.

Declaration
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int index)
Parameters
Type Name Description
KeyValuePair<TKey, TValue>[] array

The one-dimensional System.Array that is the destination of the elements copied from ObservableDictionary<TKey, TValue>. The System.Array must have zero-based indexing.

System.Int32 index

The zero-based index in array at which copying begins.

| Improve this Doc View Source

GetEnumerator()

Returns an enumerator that iterates through the ObservableDictionary<TKey, TValue>.

Declaration
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns
Type Description
IEnumerator<KeyValuePair<TKey, TValue>>

An enumerator that can be used to iterate through the ObservableDictionary<TKey, TValue>.

| Improve this Doc View Source

Remove(TKey)

Removes the value with the specified key from the System.Collections.Generic.Dictionary`2.

Declaration
public bool Remove(TKey key)
Parameters
Type Name Description
TKey key

The key of the element to remove.

Returns
Type Description
System.Boolean

true if the element is successfully found and removed; otherwise, false. This method returns false if key is not found in the System.Collections.Generic.Dictionary`2.

| Improve this Doc View Source

Remove(KeyValuePair<TKey, TValue>)

Removes the value with the specified from the System.Collections.Generic.Dictionary`2.

Declaration
public bool Remove(KeyValuePair<TKey, TValue> item)
Parameters
Type Name Description
KeyValuePair<TKey, TValue> item

The of the element to remove.

Returns
Type Description
System.Boolean

true if the element is successfully found and removed; otherwise, false. This method returns false if key is not found in the System.Collections.Generic.Dictionary`2.

| Improve this Doc View Source

TryGetValue(TKey, out TValue)

Gets the value associated with the specified key.

Declaration
public bool TryGetValue(TKey key, out TValue value)
Parameters
Type Name Description
TKey key

The key whose value to get.

TValue value

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. This parameter is passed uninitialized.

Returns
Type Description
System.Boolean

true if the object that implements System.Collections.Generic.IDictionary`2 contains an element with the specified key; otherwise, false.

Events

| Improve this Doc View Source

Change

Event that fires before the value will change.

Declaration
public event EventHandler<ObservableDictionaryCancellableEventArgs> Change
Event Type
Type Description
EventHandler<ObservableDictionaryCancellableEventArgs>
| Improve this Doc View Source

Changed

Event that fires after the value has changed.

Declaration
public event EventHandler<ObservableDictionaryEventArgs> Changed
Event Type
Type Description
EventHandler<ObservableDictionaryEventArgs>

Explicit Interface Implementations

| Improve this Doc View Source

IAtomProvider.Atom

Gets the atom.

Declaration
IAtom IAtomProvider.Atom { get; }
Returns
Type Description
IAtom

Implements

IReadOnlyDictionary<, >
ICollection<>
IReadOnlyCollection<>
IDictionary
IEnumerable<>
ICollection
IEnumerable
IAtomProvider

Extension Methods

TraceExtensions.Trace<TObject, TMember>(TObject, Expression<Func<TObject, TMember>>, TraceMode)
ReactiveObjectTypeUtilExtensions.GetObservable(Object)
ReactiveObjectTypeUtilExtensions.GetObservable<TObject, TMember>(TObject, Expression<Func<TObject, TMember>>)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX