NanoByte.Common
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
NanoByte.Common.Undo.AddToCollection< T > Class Template Reference

An undo command that adds an element to a collection. More...

Inheritance diagram for NanoByte.Common.Undo.AddToCollection< T >:
NanoByte.Common.Undo.CollectionCommand< T > NanoByte.Common.Undo.SimpleCommand NanoByte.Common.Undo.IValueCommand NanoByte.Common.Undo.IUndoCommand NanoByte.Common.Undo.IUndoCommand

Public Member Functions

 AddToCollection (ICollection< T > collection, T element)
 Creates a new add to collection command. More...
 
- Public Member Functions inherited from NanoByte.Common.Undo.SimpleCommand
void Execute ()
 Performs the desired action. More...
 
virtual void Undo ()
 Undoes the changes made by Execute. More...
 

Static Public Member Functions

static AddToCollection< T > For< T > (ICollection< T > collection, T element)
 Creates a new add to collection command. More...
 

Protected Member Functions

override void OnExecute ()
 Adds the element to the collection. More...
 
override void OnUndo ()
 Removes the element from the collection. More...
 
- Protected Member Functions inherited from NanoByte.Common.Undo.CollectionCommand< T >
 CollectionCommand (ICollection< T > collection, T element)
 Creates a new collection command. More...
 

Additional Inherited Members

- Public Attributes inherited from NanoByte.Common.Undo.CollectionCommand< T >
object Value => Element
 
- Protected Attributes inherited from NanoByte.Common.Undo.CollectionCommand< T >
readonly ICollection< T > Collection
 The collection to be modified. More...
 
readonly T Element
 The element to be added or removed from Collection. More...
 
- Properties inherited from NanoByte.Common.Undo.IValueCommand
object Value [get]
 

Detailed Description

An undo command that adds an element to a collection.

Factory methods for AddToCollection<T>.

Template Parameters
TThe type of elements the collection contains.

Constructor & Destructor Documentation

◆ AddToCollection()

NanoByte.Common.Undo.AddToCollection< T >.AddToCollection ( ICollection< T >  collection,
element 
)
inline

Creates a new add to collection command.

Parameters
collectionThe collection to be modified.
elementThe element to be added to collection .

Member Function Documentation

◆ For< T >()

static AddToCollection<T> NanoByte.Common.Undo.AddToCollection< T >.For< T > ( ICollection< T >  collection,
element 
)
static

Creates a new add to collection command.

Parameters
collectionThe collection to be modified.
elementThe element to be added to collection .
Template Parameters
TThe type of elements the collection contains.

◆ OnExecute()

override void NanoByte.Common.Undo.AddToCollection< T >.OnExecute ( )
protectedvirtual

Adds the element to the collection.

Implements NanoByte.Common.Undo.SimpleCommand.

◆ OnUndo()

override void NanoByte.Common.Undo.AddToCollection< T >.OnUndo ( )
protectedvirtual

Removes the element from the collection.

Implements NanoByte.Common.Undo.SimpleCommand.


The documentation for this class was generated from the following file: