Given this code:
List<string> things = new List<string>();
foreach (string thing in things)
{
string foo = thing.ToUpper();
}
string foo = String.Empty;
Why does the compiler complain that foo is declared twice? Surely the instance declared in the foreach loop is only valid within the scope of the loop?