为什么 C# 允许这样做:
var s = "Nice";
switch (s)
{
case "HI":
break;
const string x = "Nice";
case x:
Console.Write("Y");
break;
}
但不是这个:
var s = "Nice";
switch (s)
{
const string x = "Nice";
case x:
Console.Write("Y");
break;
}