C#是否始终允许您在switch()
语句之间的case:
语句内省略大括号?
像javascript程序员经常做的那样,省略它们有什么作用?
例:
switch(x)
{
case OneWay:
{ // <---- Omit this entire line
int y = 123;
FindYou(ref y);
break;
} // <---- Omit this entire line
case TheOther:
{ // <---- Omit this entire line
double y = 456.7; // legal!
GetchaGetcha(ref y);
break;
} // <---- Omit this entire line
}