[]
Check current value is a valid Enum type
public static bool IsValid(int enumValue, int minValueOfEnum, int maxValueOfEnum)
Type | Name | Description |
---|---|---|
int | enumValue | An int indivate the value you want to check |
int | minValueOfEnum | An int indicate the minimum value of your enum type |
int | maxValueOfEnum | An int indicate the maximum value of your enum type |
Type | Description |
---|---|
bool | A bool indicate the check result, if current value is a valid enum type, return true; otherwise false |
This method is applicable to check a Sequential defined not-flag-style enum type
Check current value is a valid Enum type
public static bool IsValid(int enumValue, int minValueOfEnum, int maxValueOfEnum, int maxNumberOfBitsOn)
Type | Name | Description |
---|---|---|
int | enumValue | An int indivate the value you want to check |
int | minValueOfEnum | An int indicate the minimum value of your enum type |
int | maxValueOfEnum | An int indicate the maximum value of your enum type |
int | maxNumberOfBitsOn | An int indicate the max count of bit for test enum value |
Type | Description |
---|---|
bool | A bool indicate the check result, if current value is a valid enum type, return true; otherwise false |
This method is applicable to check a Sequential defined flag-style enum type
EnumHelper.IsValid(0x5f, 0x0f, 0x100, 8);
In this scenario, the four parameter is 8, because the max value is 0x100(Binary as 100000000), the max bits on value is 0xff (Binary as 11111111), it's the max number of bits on