Cast an Int Value to an Enum Value in C#

Oftentimes, the input is an integer that has to be converted to the appropriate enum value. All we have to do is cast the integer value as below:

EnumName e = (EnumName)5;
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

More From DevX