Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Properties | Public Member Functions | Events | List of all members
Loyc.Collections.Impl.DictionaryWithChangeEvents< K, V, TDictionary > Class Template Reference

A dictionary wrapper that provides ListChanging and ListChanged events. You can also implement custom behavior by overriding its methods. More...


Source file:
Inheritance diagram for Loyc.Collections.Impl.DictionaryWithChangeEvents< K, V, TDictionary >:
Loyc.Collections.Impl.DictionaryWrapper< K, V, TDictionary > Loyc.Collections.IDictionaryWithChangeEvents< K, V > Loyc.Collections.IAddRange< in T > Loyc.Collections.Impl.CollectionWrapper< T, TCollection > Loyc.Collections.IDictionaryAndReadOnly< K, V > Loyc.Collections.IDictionaryAndReadOnly< K, V > Loyc.Collections.INotifyListChanging< T, TCollection > Loyc.Collections.INotifyListChanged< T, TCollection > Loyc.Collections.ICount Loyc.Collections.ICollectionAndReadOnly< T > Loyc.Collections.IIndexed< in K, out V > Loyc.Collections.ICollectionAndReadOnly< T > Loyc.Collections.IIndexed< in K, out V > Loyc.WrapperBase< T > Loyc.Collections.DictionaryWithChangeEvents< K, V >

Remarks

A dictionary wrapper that provides ListChanging and ListChanged events. You can also implement custom behavior by overriding its methods.

The Keys and Values properties return ICollection, but this class assumes that mutating these collections is not allowed (mutating them is not allowed, for example, by Dictionary{K,V}). Therefore change notification is not implemented for changes to these collections; these properties simply return the original collection.

See also
ListWrapper{TList,T}
Type Constraints
TDictionary :IDictionary 
TDictionary :K 
TDictionary :V 

Properties

override V this[K key] [get, set]
 
- Properties inherited from Loyc.Collections.Impl.DictionaryWrapper< K, V, TDictionary >
virtual V this[K key] [get, set]
 
- Properties inherited from Loyc.Collections.IIndexed< in K, out V >
this[K key] [get]
 Gets the value associated with the specified key. More...
 
- Properties inherited from Loyc.Collections.ICount
int Count [get]
 Gets the number of items in the collection. More...
 

Public Member Functions

 DictionaryWithChangeEvents (TDictionary dictionary)
 
virtual bool TryAdd (K key, V value)
 
override void Add (KeyValuePair< K, V > item)
 
override void Add (K key, V value)
 
override void Clear ()
 
override bool Remove (KeyValuePair< K, V > item)
 
override bool Remove (K key)
 
virtual void AddRange (IEnumerable< KeyValuePair< K, V >> list)
 
virtual void AddRange (IReadOnlyCollection< KeyValuePair< K, V >> list)
 
- Public Member Functions inherited from Loyc.Collections.Impl.DictionaryWrapper< K, V, TDictionary >
 DictionaryWrapper (TDictionary dictionary)
 
virtual bool ContainsKey (K key)
 
virtual bool TryGetValue (K key, [MaybeNullWhen(false)] out V value)
 
TryGet (K key, out bool fail)
 
- Public Member Functions inherited from Loyc.Collections.Impl.CollectionWrapper< T, TCollection >
 CollectionWrapper (TCollection collection)
 
virtual void Add (T item)
 
virtual bool Remove (T item)
 
virtual bool Contains (T item)
 
virtual void CopyTo (T[] array, int arrayIndex)
 
virtual IEnumerator< T > GetEnumerator ()
 
- Public Member Functions inherited from Loyc.WrapperBase< T >
override bool Equals (object?obj)
 Returns true iff the parameter 'obj' is a wrapper around an object that is equal to the object that this object wraps. More...
 
override int GetHashCode ()
 Returns the hashcode of the wrapped object. More...
 
override string ToString ()
 Returns ToString() of the wrapped object. More...
 
- Public Member Functions inherited from Loyc.Collections.IAddRange< in T >
void AddRange (IEnumerable< T > e)
 
void AddRange (IReadOnlyCollection< T > s)
 

Events

virtual ListChangingHandler
< KeyValuePair< K, V >
, IDictionary< K, V > > 
ListChanging
 
virtual ListChangingHandler
< KeyValuePair< K, V >
, IDictionary< K, V > > 
ListChanged
 
- Events inherited from Loyc.Collections.INotifyListChanging< T, TCollection >
ListChangingHandler< T,
TCollection > 
ListChanging
 Occurs when the collection associated with this interface is about to change. More...
 
- Events inherited from Loyc.Collections.INotifyListChanged< T, TCollection >
ListChangingHandler< T,
TCollection > 
ListChanged
 Occurs when the collection associated with this interface has changed. More...
 

Additional Inherited Members

- Public fields inherited from Loyc.Collections.Impl.DictionaryWrapper< K, V, TDictionary >
virtual ICollection< K > Keys => _obj.Keys
 
virtual ICollection< V > Values => _obj.Values
 
- Public fields inherited from Loyc.Collections.Impl.CollectionWrapper< T, TCollection >
bool IsEmpty => Count == 0
 
virtual int Count => _obj.Count
 
virtual bool IsReadOnly => _obj.IsReadOnly
 
- Protected Member Functions inherited from Loyc.WrapperBase< T >
 WrapperBase (T wrappedObject)
 
- Protected fields inherited from Loyc.Collections.Impl.DictionaryWrapper< K, V, TDictionary >
TDictionary Dictionary => _obj
 
- Protected fields inherited from Loyc.Collections.Impl.CollectionWrapper< T, TCollection >
TCollection Collection => _obj
 
- Protected fields inherited from Loyc.WrapperBase< T >
_obj
 
- Protected static fields inherited from Loyc.WrapperBase< T >
static readonly
EqualityComparer< T > 
TComp = EqualityComparer<T>.Default