T
Tomasz J
The attached program does not compile. The error message says:
"A local variable named 'i' cannot be declared in this scope because it
would give a different meaning to 'i', which is already used in a 'child'
scope to denote something else"
- which does not make much sense. Is it a compiles bug?
TJ
class Program
{
static void Main(string[] args)
{
switch (0) {
case 0:
for (int i = 0; ; ) {
}
case 1:
// error CS0136: A local variable named 'i' cannot be declared
in this scope because it would give a different meaning to 'i', which is
already used in a 'child' scope to denote something else
int i = 0;
}
}
}
"A local variable named 'i' cannot be declared in this scope because it
would give a different meaning to 'i', which is already used in a 'child'
scope to denote something else"
- which does not make much sense. Is it a compiles bug?
TJ
class Program
{
static void Main(string[] args)
{
switch (0) {
case 0:
for (int i = 0; ; ) {
}
case 1:
// error CS0136: A local variable named 'i' cannot be declared
in this scope because it would give a different meaning to 'i', which is
already used in a 'child' scope to denote something else
int i = 0;
}
}
}