ToEnum<TEnumType>()

Converts the integer representation to its corresponding enumeration.

Declaration
public static TEnumType ToEnum<TEnumType>(this int value)
Example
private enum Level
{
    Low = 0,
    Medium = 15,
    High = 30,
}

0.ToEnum<Level>();
30.ToEnum<Level>();
123.ToEnum<Level>();
Result
Level.Low
Level.High
Level.Low

Last updated