Switch Fall Through Not Working as Expected
This question already has an answer here:
In C# you must explicitly leave the case
section in question. You can use goto case "MSI";
in the end of the first section.
Of course a section of a switch
block can also end with break
, return
, throw
, an infinite loop (that the C# compiler can determine is infinite) and so on.
上一篇: 使用if / else和switch之间是否存在显着差异?
下一篇: 按预期切换失败