ComponentOne CalendarView for WinForms
C1.Framework Namespace / EnumHelper Class / IsValid Method / IsValid(Int32,Int32,Int32,Int32) Method
An int indivate the value you want to check
An int indicate the minimum value of your enum type
An int indicate the maximum value of your enum type
An int indicate the max count of bit for test enum value
Example

In This Topic
    IsValid(Int32,Int32,Int32,Int32) Method
    In This Topic
    Check current value is a valid Enum type
    Syntax
    'Declaration
     
    
    Public Overloads Shared Function IsValid( _
       ByVal enumValue As Integer, _
       ByVal minValueOfEnum As Integer, _
       ByVal maxValueOfEnum As Integer, _
       ByVal maxNumberOfBitsOn As Integer _
    ) As Boolean

    Parameters

    enumValue
    An int indivate the value you want to check
    minValueOfEnum
    An int indicate the minimum value of your enum type
    maxValueOfEnum
    An int indicate the maximum value of your enum type
    maxNumberOfBitsOn
    An int indicate the max count of bit for test enum value

    Return Value

    A bool indicate the check result, if current value is a valid enum type, return true; otherwise false
    Remarks
    This method is applicable to check a Sequential defined flag-style enum type There is a enum value you want to test is 0x5f, in this enum type, the min value is 0x0f, and max value is 0x100, then this method called below can test its validation: 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
    Example
    There is a enum value you want to test is 0x5f, in this enum type, the min value is 0x0f, and max value is 0x100, then this method called below can test its validation: 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
    EnumHelper.IsValid(0x5f, 0x0f, 0x100, 8);
    See Also