BalloonsPop.Core.Commands.CommandFactory.CreateCommand C# (CSharp) Méthode

CreateCommand() public méthode

A method to create a command.
public CreateCommand ( string commandName ) : ICommand
commandName string
Résultat ICommand
        public ICommand CreateCommand(string commandName)
        {
            if (!this.ContainsKey(commandName))
            {
                throw new KeyNotFoundException("No command with such key was registered");
            }

            if (!this.commandCache.ContainsKey(commandName))
            {
                this.commandCache.Add(commandName, this.commandMap[commandName]());
            }

            return this.commandCache[commandName];
        }