c# switch中使用goto

来源:互联网 发布:基因药物有哪些 知乎 编辑:程序博客网 时间:2024/04/27 17:51
var a=0;switch(month){  case "a":a=1;  case "b":a=2;  case "c":a=3;}

上面中情况在c#中是不允许的

但是下面的用法在c#中却是可以的

switch(month){    case "a":a=1;goto case "c";  case "b":a=2;goto case "a";  case "c":a=3;}