i have an enum with custom attributes, something like:
public enum EnumStatus
{
[CharValue('*')]
Empty,
[CharValue('A')]
value1,
[CharValue('P')]
value2,
}
the "forward" way seems easy, coming with an enum value an getting the custom attribute using reflection, GetCustomAttributes and that like.
but i want some kind of reverse resolving. having an char value, i want to have an enum value to work with.
something like:
public static Enum GetEnumValue(this Enum source, char value)
{...}
which should return EnumStatus.value1, if i put an 'A' as value parameter.
any ideas? i do not want to make an extra hashtable, deferring the enums.
thank you so much!
from the example i made this here:
works great...