Class AddToCollection<T>
An undo command that adds an element to a collection.
public sealed class AddToCollection<T> : CollectionCommand<T>, IValueCommand, IUndoCommand where T : notnull
Type Parameters
T
The type of elements the collection contains.
- Inheritance
-
AddToCollection<T>
- Implements
- Inherited Members
- Extension Methods
Constructors
AddToCollection(ICollection<T>, T)
An undo command that adds an element to a collection.
public AddToCollection(ICollection<T> collection, T element)
Parameters
collection
ICollection<T>The collection to be modified.
element
TThe element to be added to
collection
.
Methods
OnExecute()
Adds the element to the collection.
protected override void OnExecute()
OnUndo()
Removes the element from the collection.
protected override void OnUndo()