【问题标题】:comparison structure within select case选择案例中的比较结构
【发布时间】:2013-11-15 08:02:33
【问题描述】:

我很少使用 select case,但认为它适合此功能。第二种和第三种情况如何比较?编译器不喜欢该代码。在 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

【问题讨论】:

    标签: vb.net select-case


    【解决方案1】:

    可能是这样的:

    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
    

    参考资料:

    【讨论】:

      猜你喜欢
      • 2022-07-17
      • 2017-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多