Possible Duplicate:
Case Statement Block Level Declaration Space in C#
For example:
string danger;
switch ( this.Type )
{
case Warfare.Nuclear:
case Warfare.Biological:
case Warfare.Chemical:
danger = "deadly";
break;
case Warfare.Air:
string threat = "major"
...
break;
case Warfare.Ground:
string threat = "medium"
...
break;
}
Why can't I just define local variables with the same name in each, without having to use different names or declaring the variable outside the switch statement which won't be used outside it anyways.