Class ObservableConcurrentDictionary<TKey, TValue>
A thread-safe dictionary that raises collection and property change notifications when items are added, removed, or modified.
public class ObservableConcurrentDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged
Type Parameters
TKeyThe type of keys in the dictionary.
TValueThe type of values in the dictionary.
- Inheritance
-
ObservableConcurrentDictionary<TKey, TValue>
- Implements
-
IDictionary<TKey, TValue>ICollection<KeyValuePair<TKey, TValue>>IEnumerable<KeyValuePair<TKey, TValue>>
- Inherited Members
- Extension Methods
Properties
Count
public int Count { get; }
Property Value
IsReadOnly
public bool IsReadOnly { get; }
Property Value
this[TKey]
public TValue this[TKey key] { get; set; }
Parameters
keyTKey
Property Value
- TValue
Keys
public ICollection<TKey> Keys { get; }
Property Value
- ICollection<TKey>
Values
public ICollection<TValue> Values { get; }
Property Value
- ICollection<TValue>
Methods
Add(KeyValuePair<TKey, TValue>)
public void Add(KeyValuePair<TKey, TValue> item)
Parameters
itemKeyValuePair<TKey, TValue>
Add(TKey, TValue)
public void Add(TKey key, TValue value)
Parameters
keyTKeyvalueTValue
Clear()
public void Clear()
Contains(KeyValuePair<TKey, TValue>)
public bool Contains(KeyValuePair<TKey, TValue> item)
Parameters
itemKeyValuePair<TKey, TValue>
Returns
ContainsKey(TKey)
public bool ContainsKey(TKey key)
Parameters
keyTKey
Returns
CopyTo(KeyValuePair<TKey, TValue>[], int)
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
Parameters
arrayKeyValuePair<TKey, TValue>[]arrayIndexint
GetEnumerator()
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns
- IEnumerator<KeyValuePair<TKey, TValue>>
OnCollectionChanged(NotifyCollectionChangedEventArgs)
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
Parameters
OnPropertyChanged(string)
protected virtual void OnPropertyChanged(string name)
Parameters
namestring
Remove(KeyValuePair<TKey, TValue>)
public bool Remove(KeyValuePair<TKey, TValue> item)
Parameters
itemKeyValuePair<TKey, TValue>
Returns
Remove(TKey)
public bool Remove(TKey key)
Parameters
keyTKey
Returns
TryGetValue(TKey, out TValue)
public bool TryGetValue(TKey key, out TValue value)
Parameters
keyTKeyvalueTValue
Returns
Events
CollectionChanged
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Type
PropertyChanged
public event PropertyChangedEventHandler PropertyChanged