Command Pattern : How to pass parameters to a command?

前端 未结 13 1054
夕颜
夕颜 2020-12-07 16:43

My question is related to the command pattern, where we have the following abstraction (C# code) :

public interface ICommand
{
    void Execute();
}
<         


        
13条回答
  •  無奈伤痛
    2020-12-07 16:55

    In the constructor and stored as fields.

    You will also want to eventually make your ICommands serializable for the undo stack or file persistence.

提交回复
热议问题