switch(n) { case 1: cost += 25; break; case 2: cost += 25; goto case 1; case 3: cost += 50; goto case 1; default: Console.WriteLine("Invalid selection. Please select 1, 2, or 3."); break; }
如果是string的case,同样可以跳转:goto case "name";
本文转自齐师傅博客园博客,原文链接:http://www.cnblogs.com/youring2/archive/2011/09/08/2171137.html,如需转载请自行联系原作者