VB.NET Switch Statement GoTo Case

前端 未结 9 996
你的背包
你的背包 2020-12-10 23:42

I am writing some code in VB.NET that uses a switch statement but in one of the cases it needs to jump to another block. In C# it would look like this:

switc         


        
9条回答
  •  北海茫月
    2020-12-11 00:31

    Select Case parameter 
        Case "userID"
            ' does something here.
        Case "packageID"
            ' does something here.
        Case "mvrType" 
            If otherFactor Then 
                ' does something here.
            End If 
        Case Else 
            ' does some processing... 
            Exit Select 
    End Select
    

    Is there a reason for the goto? If it doesn't meet the if criterion, it will simply not perform the function and go to the next case.

提交回复
热议问题