lolol a lil complicated for me what if i do something like this, Im
having a lil trouble with it, can you tell me what im doing wrong
public enum ValidAnimals
{
[Description("BEAR")] A = 0x0000, //is there a way to get the description base off of the 0x0000
[Description("DOG ")] B = 0x0001,
[Description("CAT ")] C = 0x0002,
}
public string GetName(string Value)
{Value ="0000";
FieldInfo fi = stringValue.GetType().GetField(Value);
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
return (attributes.Length > 0) ? attributes[0].Description : stringValue;
}
im basically get a 4 nibble string, and I want to do a look up via the above enum, so like "0000" means Bear, Bear is the value i want to get back