In my program, I have created a class called Monsters. It is defined by four different enums: Species, Rarity, Region and Type. I am trying to create a list. Here is the code I have written:
public class Monsters
{
public Enums.Species monsterName;
public Enums.Rarity rarity;
public Enums.Region region;
public Enums.Type monsterType;
public Monsters(Enums.Species monsterName, Enums.Rarity rarity, Enums.Region region, Enums.Type monsterType)
{
this.monsterName = monsterName;
this.rarity = rarity;
this.region = region;
this.monsterType = monsterType;
}
public Enums.Species getmonsterName()
{
return monsterName;
}
public Enums.Rarity getrarity()
{
return rarity;
}
public Enums.Region getregion()
{
return region;
}
public Enums.Type getmonsterType()
{
return monsterType;
}
List<Monsters> startersPokemon = new List<Monsters>();
startersPokemon.Add(Enums.Species.PIKACHU, Enums.Rarity.rare, Enums.Region.Pallet, Enums.Type.electric);
}
When I type the final line of code where I try to add to the list, I keep getting an error telling me it is a field being used as a type. How can I rectify this problem? If a list isn't the answer to my problem, would an array be better?