convert int to enum code example
Example 1: C# .net core convert int to enum
if (Enum.IsDefined(typeof(YourEnum), yourInt))
{
return (YourEnum) yourInt;
}
OR:
if (Enum.IsDefined(typeof(YourEnum), yourInt))
{
return (YourEnum) Enum.ToObject(typeof(YourEnum), yourInt);
}
Example 2: int to enum java
EnumType.values()[someInt]
Example 3: convert int to enum c#
YourEnum foo = (YourEnum)yourInt;