// The Context allows changing the State object at runtime. public void TransitionTo(IDocumentState state) { Console.WriteLine($"Context: Transition to {state.GetType().Name}."); _state = state; _state.SetContext(this); }
public Document(IDocumentState state) { this.TransitionTo(state); }