VB.NET Switch Statement GoTo Case -
I am VB I am writing some code in the net which uses a switch statement, but in one case it needs to jump in the second block. In C #, it will look like this:
switch (parameter) {case "userID": // here does something like "packageID": // Here does something like "mvrType": If (otherFactor) {// here does something} and (default); } Default: // Some processing ... break; } However, I do not know how to convert it to VB.NET. I tried to do this:
Choose the case parameter Case "UserID" 'does something here. Case "package id" does something here "mvrType" if other feature then does something here 'otherwise Gato case or ends if case makes some processing ... select choose exit But when I do this I get a compiler error: "Expect the identifier". Under the "case" is there a detour line?
Besides, is it wrong to use a statement statement in this matter? It seems that I have to write it again.
I changed my code as follows:
If other features and parameters = "mvrType" then 'here does something' 'my original' Select case case "here" mvrType "select without case for end if
switch (args [0]) {case "UserID": console.light ("user id"); break; Case "PackageID": console Type ("PackageID"); break; Case "MVRType": if (args [1] == "none") console Type ("none"); Second Goto default; break; Default: Console. Type ("default"); break; } gave me the following VB.NET output. If the string = Argus (0) is not ($ CS $ 4 0000 is nothing), then again (CS $ 4 $ 0000 = "UserID") then the As you can see if you can complete the same case case statement with the statement. Generally I do not recommend it because it makes it difficult to understand, but VB.NET does not support the same functionality, and the best way to get the code to use the reflector is to get it out Too much pain should work Update: Just you VB Nets can not do the same thing, but it supports some other useful things. It seems that the IF statement conversion is your best bet, or perhaps some refactoring is the definition for selection here ... Case
Comments
Post a Comment