Exemplo n.º 1
0
        static void Invock12()
        {
            StateContext context = new StateContext(new StateA());

            context.Request();
            context.Request();
            context.Request();
            context.Request();
            context.Request();
            context.Request();
        }
 public abstract void Handle(StateContext context);
 public override void Handle(StateContext context)
 {
     context.State = new StateA();
 }
Exemplo n.º 4
0
 public override void Handle(StateContext context)
 {
     context.State = new StateA();
     Console.WriteLine($"StateB.Handle状态:StateContext.State={ context.State.GetType().Name}");
 }