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

An undo command that replaces an element in a list with a new one. More...

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

Public Member Functions

 ReplaceInList (IList< T > list, T oldElement, T newElement)
 Creates a new replace in list 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 ReplaceInList< T > For< T > (IList< T > list, T oldElement, T newElement)
 Creates a new replace in list command. More...
 

Public Attributes

object Value => _newElement
 

Protected Member Functions

override void OnExecute ()
 Template method to perform the desired action. More...
 
override void OnUndo ()
 Template method to undo the changes made by OnExecute. More...
 

Additional Inherited Members

- Properties inherited from NanoByte.Common.Undo.IValueCommand
object Value [get]
 

Detailed Description

An undo command that replaces an element in a list with a new one.

Factory methods for ReplaceInList<T>.

Template Parameters
TThe type of elements the list contains.

Constructor & Destructor Documentation

◆ ReplaceInList()

NanoByte.Common.Undo.ReplaceInList< T >.ReplaceInList ( IList< T >  list,
oldElement,
newElement 
)
inline

Creates a new replace in list command.

Parameters
listThe collection to be modified.
oldElementThe element to be removed from list .
newElementThe element to be added to list .

Member Function Documentation

◆ For< T >()

static ReplaceInList<T> NanoByte.Common.Undo.ReplaceInList< T >.For< T > ( IList< T >  list,
oldElement,
newElement 
)
static

Creates a new replace in list command.

Parameters
listThe collection to be modified.
oldElementThe element to be removed from list .
newElementThe element to be added to list .
Template Parameters
TThe type of elements the list contains.

◆ OnExecute()

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

Template method to perform the desired action.

Implements NanoByte.Common.Undo.SimpleCommand.

◆ OnUndo()

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

Template method to undo the changes made by OnExecute.

Implements NanoByte.Common.Undo.SimpleCommand.


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