See anything wrong with the code below? I didn't until Visual Studio gave me a nice squiggly red line indicating something was wrong.
IList aList = new List(); foreach (A a in aList) { // Do something } A a = new A();
This is the error:
A local variable named 'a' cannot be declared in this scope because it would give a different meaning to 'a', which is already used in a 'child' scope to denote something else
Does anyone know why this isn't allowed? It seems like a perfectly natural thing to do.