|
Enhanced C#
Loyc library documentation
|
A collection wrapper that provides ListChanging and ListChanged events. You can also implement custom behavior by overriding its methods. More...
A collection wrapper that provides ListChanging and ListChanged events. You can also implement custom behavior by overriding its methods.
This class is designed to support both sets and other collection types. If the underlying collection implements ISet{T}, the Add method avoids firing change notification events if the requested item is already in the set. Regardless of whether the collection is a set, the Remove method also avoids firing any notifications when the requested item is not in the collection.
| T | Type of each list item |
| TColl | Type of the underlying collection |
| TColl | : | ICollection<T> |
Public fields | |
| ISet< T > | _asSet |
Public fields inherited from Loyc.Collections.Impl.CollectionWrapper< T, TCollection > | |
| bool | IsEmpty => Count == 0 |
| virtual int | Count => _obj.Count |
| virtual bool | IsReadOnly => _obj.IsReadOnly |
Public Member Functions | |
| override void | Add (T item) |
| virtual bool | TryAdd (T item) |
| Synonym for Add(). If the collection implements ISet{T}, this method returns false if the item is already present in the set; otherwise it always returns true. More... | |
| override void | Clear () |
| override bool | Remove (T item) |
Public Member Functions inherited from Loyc.Collections.Impl.CollectionWrapper< T, TCollection > | |
| CollectionWrapper (TCollection collection) | |
| 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... | |
Events | |
|
CollectionWithChangeEvents(TColl wrappedObject) virtual ListChangingHandler< T, ICollection< T > > | ListChanging |
|
virtual ListChangingHandler< T, ICollection< T > > | 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 | |
Protected Member Functions inherited from Loyc.WrapperBase< T > | |
| WrapperBase (T wrappedObject) | |
Protected fields inherited from Loyc.Collections.Impl.CollectionWrapper< T, TCollection > | |
| TCollection | Collection => _obj |
Protected fields inherited from Loyc.WrapperBase< T > | |
| T | _obj |
Protected static fields inherited from Loyc.WrapperBase< T > | |
|
static readonly EqualityComparer< T > | TComp = EqualityComparer<T>.Default |
|
inlinevirtual |
Synonym for Add(). If the collection implements ISet{T}, this method returns false if the item is already present in the set; otherwise it always returns true.
1.8.7