VB.NET Switch Statement GoTo Case

前端 未结 9 999
你的背包
你的背包 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:19

    In VB.NET, you can apply multiple conditions even if the other conditions don't apply to the Select parameter. See below:

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

提交回复
热议问题