I have the following enum:
public enum GenderContract
{
Male,
Female,
Unknown
}
But I am getting from a client the values of 'M', 'F' and 'U'.
Is there a generic way to convert from the first char of the enum to the actual enum item? (Assuming that there are no collisions in names?)
I have several such scenarios and I would like to be able to have a generic way to convert partial matches to enums if possible (instead of just doing a switch statement or something like that).