public void Do(AbstractCommand cmd, object input) { if (undo.Count == MaxSize) { // TODO needs disposing? undo.RemoveFirst(); } cmd.Do(context, input); undo.AddLast(new CommandInstance()); redo.Clear(); // Once we issue a new command, the redo stack clears }