コード例 #1
0
 // 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);
 }
コード例 #2
0
 public Document(IDocumentState state)
 {
     this.TransitionTo(state);
 }