interface ICommand { void Execute(); } // FIFO: first in first out // queue // LIFO: last in first out // stack IQueue q = [StopC, RMC] while(!stop) { var c = q.Take(); try { c.Execute(); } catch (Execute e) { // handler } } // Pre, Act, Post class SimpleMacroCommand: ICommand { private Array commands; public MoveOperation() { this.commands = commands; } void Execute() { //var commands = ??? foreach (var c in commands) { c.Execute(); } } } // S0 -c1-> S1 -c2-> S2 -c3-> S3 // ac1 ac2 ac3 class RepeatCommand: ICommand { RepeatCommand() { } } IoC.Resolve("Операция движения", obj1, (3,2)); IoC.Resolve("IoC.Register", "Операция движения", () => { }); class IoC { IDictonary> store; static T Resolve(string key, params object[] args) { object res = store[key](args); return (T)res; } }