devxlogo

Cast an Int Value to an Enum Value in C#

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;

devx-admin

Share the Post: