IsInterval

        ''' <summary>
        ''' Determines if the Integer is of the specified interval.  E.g. if the interval is 100 and the integer is 400, it would return true. 
        ''' This function uses the Mod operator, for the above example: (300 Mod 100 = 0)
        ''' </summary>
        ''' <param name="num"></param>
        ''' <param name="interval"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        <Extension()> _
        Public Function IsInterval(ByVal num As Integer, ByVal interval As Integer) As Boolean
            If num Mod interval = 0 Then
                Return True
            Else
                Return False
            End If
        End Function
Example:
Dim num As Integer = 200

If num.IsInterval(100) = True Then
   ' do something if fits the interval

End IF

Description

Determines if the Integer is of the specified interval. E.g. if the interval is 100 and the integer is 400, it would return true. 127 would return false. This function uses the Mod operator, for the above example: (300 Mod 100 = 0)

Details

Double click on the code to select all.

 

;