Enhanced C#
Language of your choice: library documentation
Public fields | Public Member Functions | Protected fields | List of all members
Loyc.Collections.Impl.CollectionWrapper< T, TCollection > Class Template Reference

A simple base class that helps you use the decorator pattern on a collection. By default, all it does is forward every method to the underlying collection (including GetHashCode, Equals and ToString). You can change its behavior by overriding methods. More...


Source file:
Inheritance diagram for Loyc.Collections.Impl.CollectionWrapper< T, TCollection >:
Loyc.WrapperBase< TCollection >

Remarks

A simple base class that helps you use the decorator pattern on a collection. By default, all it does is forward every method to the underlying collection (including GetHashCode, Equals and ToString). You can change its behavior by overriding methods.

This could be used, for example, to help you implement a collection that needs to take some kind of action whenever the collection is modified.

See also
ListWrapper<TList,T>
Type Constraints
TCollection :ICollection<T> 

Public fields

virtual int Count => _obj.Count
 
virtual bool IsReadOnly => _obj.IsReadOnly
 

Public Member Functions

 CollectionWrapper (TCollection collection)
 
virtual void Add (T item)
 
virtual void Clear ()
 
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< TCollection >
override bool Equals (object obj)
 Returns true iff the parameter 'obj' is a wrapper around the same 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...
 

Protected fields

TCollection Collection => _obj
 
- Protected fields inherited from Loyc.WrapperBase< TCollection >
_obj
 

Additional Inherited Members

- Protected Member Functions inherited from Loyc.WrapperBase< TCollection >
 WrapperBase (T wrappedObject)
 
- Protected static fields inherited from Loyc.WrapperBase< TCollection >
static readonly EqualityComparer< T > TComp