Better Way To Get Char Enum

c#, char, enums

Solution

Just cast the value:

char status = (char)Enums.DivisionStatus.Active;

Note that this will use the value instead of the identifier. The `Enums.DivisionStatus.Active` value is the character code of `'A'`, as that is the value that you have defined.

Using the value directly is faster than looking up the identifier for the value.

Problem

Is there a cleaner way to get the char value of an enum in C#. ``` public enum DivisionStatus { None = 'N', Active = 'A', Inactive = 'I', Waitlist = 'W' } string status = Enums.DivisionStatus.Active.ToString()[0].ToString(); // "A" ```

Original source