public string ReportCommand(IList <string> arguments) { int id = int.Parse(arguments[0]); if (reactors.ContainsKey(id)) { IReactor reactor = reactors[id]; return(reactor.ToString()); } else { IModule module = modules[id]; return(module.ToString()); } }
public string ReportCommand(IList <string> arguments) { int id = int.Parse(arguments[0]); string result = ""; if (this.reactors.ContainsKey(id)) { IReactor reactor = this.reactors[id]; result = reactor.ToString(); } else if (modules.ContainsKey(id)) { IModule module = modules[id]; result = module.ToString(); } else { throw new ArgumentException("No entity with this id!"); } return(result); }