在 CI 中可以分配default
给一些现有的switch
条目:
switch(c) {
default :
case 1:
break;
case 2 :
break;
}
VB的select语句中是否有类似的可能性?
在 CI 中可以分配default
给一些现有的switch
条目:
switch(c) {
default :
case 1:
break;
case 2 :
break;
}
VB的select语句中是否有类似的可能性?
use case Else
,它与 c 语法的默认值相同:
Select [ Case ] testexpression
[ Case expressionlist
[ statements ] ]
[ Case Else
[ elsestatements ] ]
End Select
例如
creamcake = TextBox1.Text
Select Case creamcake
Case "Eaten"
DietState = "Diet Ruined"
Case "Not Eaten"
DietState = "Diet Not Ruined"
Case Else
DietState = "Didn't check"
End Select
如果您想分配多个案例,那么示例
Select Case agerange
Case 16 To 21
MsgBox “Still Young”
Case 50 To 64
MsgBox “Start Lying”
End Select
Select Object.Name.ToString()
Case "Name1"
'Do something
Case "Name2"
'Do something else
Case Else
'Do the default action
End Select
This question is the exact opposite of VB.NET Select...Case Statement Equivalent in C#