NanoByte.Common  2.7.0
NanoByte.Common.Undo.SetInList< T > Class Template Reference

Replaces an entry in a IList<T> with a new one. More...

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

Public Member Functions

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

Protected Member Functions

override void OnExecute ()
 Sets the new entry in the list. More...
 
override void OnUndo ()
 Restores the old entry in the list. More...
 

Properties

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

Detailed Description

Replaces an entry in a IList<T> with a new one.

Factory methods for SetInList<T>.

Template Parameters
TThe type of elements the list contains.
Type Constraints
T :notnull 

Constructor & Destructor Documentation

◆ SetInList()

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

Creates a new set in list command.

Parameters
listThe list to be modified.
oldElementThe old element currently in the list to be replaced.
newElementThe new element to take the place of oldElement in the list .

Member Function Documentation

◆ For< T >()

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

Creates a new set in list command.

Parameters
listThe list to be modified.
oldElementThe old element currently in the list to be replaced.
newElementThe new element to take the place of oldElement in the 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.SetInList< T >.OnExecute ( )
protectedvirtual

Sets the new entry in the list.

Implements NanoByte.Common.Undo.SimpleCommand.

◆ OnUndo()

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

Restores the old entry in the list.

Implements NanoByte.Common.Undo.SimpleCommand.


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