Вопрос

I don't use select case much but thought it was appropriate for this function. How does one do the comparison for the 2nd and third cases? The compiler doesn't like that code. Is it not possible to compare in this manner within Select Case?

 Private Shared Function TakeValue(ByVal interval As Integer) As Integer
    Select Case interval
        Case Is <= 15
            Return 1440
            ***Case Is > 15 And <=30
            Return 720
            Case is > 30 And <=60
            Return 528***
        Case Else
            Return 400

    End Select
End Function
Это было полезно?

Решение

Maybe something like this:

Select Case interval
  Case 0 To 15
    Return 1440
  Case 16 To 30
    Return 720
  Case 31 To 60
    Return 528
  Case Else
    Return 400
End Select

References:

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top