I have the following Enum:
public enum ItemType
{
Foo =0,
Bar =1
}
and then a string that is passed to a method in lowercase.
How can I compare the string to my enum and return the enum.
public ItemType Method(string value)
{
///compare string to enum here and return Enum
}
and the method receives the value as parameter like this (notice the lowercase)
string value = "foo"; /// or value ="bar"
ItemType type = Method(value)