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(); }
public override void Handle(StateContext context) { context.State = new StateA(); Console.WriteLine($"StateB.Handle状态:StateContext.State={ context.State.GetType().Name}"); }