コード例 #1
0
        public static Item CreateItem(string type)
        {
            switch (type)
            {
            case "PoisonPotion":
                return(new PoisonPotion());

            case "HealthPotion":
                return(new HealthPotion());

            case "ArmorRepairKit":
                return(new ArmorRepairKit());

            default:
                throw new ArgumentException(string.Format(OutputMessages.InvalidItemType(), type));
            }
        }