I have the following enum in my class:
public enum InventoryType
{
EQUIP = 1,
USE = 2,
SETUP = 3,
ETC = 4,
CASH = 5,
EVAN = 6,
TOTEMS = 7,
ANDROID = 8,
BITS = 9,
MECHANIC = 10,
HAKU = 11,
EQUIPPED = -1
}
Now, I have a field:
public InventoryType InventoryType { get; private set; }
I load the data from MySql. MySql's column of type has the string that is the InventoryType. How can I convert the string I get to the enum InventoryType?
I tried:
this.InventoryType = reader.GetString("type");
But of course, that doesn't work, because it's getting a string and required an InventoryType. What can I do to convert it? Thanks.