Hi, I want to have an enum like the following and then have a method something like Util.FindFruitByValue("A") which returns the enum Apple. this is because the abbreviations are stored in database and I need to convert them to appropriate enums after reading from db. is this possible OR do I need to create a separate class for it? Please let me know. thanks in advance.
public enum Fruit
{
Apple = "A"
Banana = "B"
Cherry = "C"
}
Update: this is like a lookup table, but the difference is the value is string instead of an int. I am populating a business object, by reading the values from database and I would like to use a type with fixed values for the object property instead of string.