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

An undo command that removes an element from a collection. More...

Inheritance diagram for NanoByte.Common.Undo.RemoveFromCollection< 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

 RemoveFromCollection (ICollection< T > collection, T element)
 Creates a new remove from 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 RemoveFromCollection< T > For< T > (ICollection< T > collection, T element)
 Creates a new remove from collection command. More...
 

Protected Member Functions

override void OnExecute ()
 Removes the element from the collection. More...
 
override void OnUndo ()
 Adds the element to 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 removes an element from a collection.

Factory methods for RemoveFromCollection<T>.

Template Parameters
TThe type of elements the collection contains.

Constructor & Destructor Documentation

◆ RemoveFromCollection()

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

Creates a new remove from collection command.

Parameters
collectionThe collection to be modified.
elementThe element to be removed from collection .

Member Function Documentation

◆ For< T >()

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

Creates a new remove from collection command.

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

◆ OnExecute()

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

Removes the element from the collection.

Implements NanoByte.Common.Undo.SimpleCommand.

◆ OnUndo()

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

Adds the element to the collection.

Implements NanoByte.Common.Undo.SimpleCommand.


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