void Main() { Handler h1 = new ConcreteHandler1(); Handler h2 = new ConcreteHandler2(); h1.Successor = h2; h1.HandleRequest(2); }
/// <summary> /// ChainOfResponsibilityPattern /// </summary> private static void ChainOfResponsibilityRun() { int condition = 2; Handler h1 = new ConcreteHandler1(); Handler h2 = new ConcreteHandler2(); h1.Successor = h2; h2.Successor = h1; h1.HandleRequest(ref condition); }