Lambda Scope Clarification
问题 Why does my parameter x behave so erratically? Example 1 - Doesn't exist in the current context. Example 2 - Cannot reuse x because it's defined in a 'child' scope. Example 3 - Fine. This is the part where I am confused. Perhaps a different 'child' scope? Example 1 : List<int> list = new List<int> { 1, 2, 3, 4, 5 }; var result = list.Where(x => x < 3); Console.Write(result.ElementAt(x)); creates this compile time error: The name 'x' does not exist in the current context which I expect.