Table of Contents

Class AddToCollection<T>

Namespace
NanoByte.Common.Undo
Assembly
NanoByte.Common.dll

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
object
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 T

The 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()