static void Main(string[] args) { ClassInvoker inv = new ClassInvoker(); IExecute exeObj = inv.CheckUsingCommandDesignPattern("Print"); exeObj.CmdExecute(); Console.ReadKey(); }
public IExecute CheckUsingCommandDesignPattern(string strCmd) { IExecute cmdObj = null; foreach (IExecute obj in _objList) { if (obj.strCommand == strCmd) { cmdObj = obj; break; } } return(cmdObj); }