C#--Switch Case语句的返回 C#中switch case语句的返回不只是用break关键字,break语句是用来阻止贯穿的最常见的方式。也可以用其他语句来替代它。如下面代码所示 static int Main(string[] args) { int a = int.Parse(Console.ReadLine()); switch (a) { case 1: Console.WriteLine(a); break; case 2: return 1; case 3: throw new Exception(); } Console.ReadKey(false); return 1; } 也可以用return语句和throw语句来替代break语句。