public void AddFish(string name, SpeciesEnum specie, int age) // adding the fish by the console { Type type = Type.GetType("Csharquarium.Models.Species." + specie.ToString()); Fish newFish = (Fish)Activator.CreateInstance(type, name, age); AddToArray(newFish); }
public void AddFish(string name, Genders gender) // add fishes to the aquarium { SpeciesEnum randomSpecie = (SpeciesEnum)RNG.Next(0, Enum.GetNames(typeof(SpeciesEnum)).Length); Type type = Type.GetType("Csharquarium.Models.Species." + randomSpecie.ToString()); Fish newFish = (Fish)Activator.CreateInstance(type, name, gender); AddToArray(newFish); }