NanoByte.Common  2.9.0
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...
 

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...
 

Properties

object Value [get]
 
- 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.
Type Constraints
T :notnull 

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.
Type Constraints
T :notnull 
T :new 
T :list 
T :oldElement 
T :newElement 

◆ 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: