Sign in
Sam Ng's Blog
Common Tasks
Blog Home
Email Blog Author
OK
RSS for comments
RSS for posts
Atom
Search Form
Tag Cloud
C# 4.0
Channel 9
CLR
CLS compliance
COM
Default parameters
DLR
Dynamic
Events
Foreach Statements
Generics
Indexed Properties
Interop
Lambda Expressions
Local Variable Scoping
Named arguments
Omit Ref
Optional arguments
Optional Modifiers
Overload Resolution
Runtime binding
SoCal CodeCamp
Type Inference
Using Statements
Variable redeclaration
Monthly Archives
Archives
January 2010
(1)
November 2009
(2)
June 2009
(1)
April 2009
(2)
February 2009
(1)
December 2008
(3)
November 2008
(4)
October 2008
(3)
March 2008
(2)
February 2008
(1)
December 2007
(1)
November 2007
(4)
Browse by Tags
MSDN Blogs
>
Sam Ng's Blog
>
All Tags
>
foreach statements
Tagged Content List
Blog Post:
Compiler-generated scopes for local variable declarations
samng
I was tasked with understanding and fixing a bug on error reporting with foreach iteration variables the other day, and it got me thinking about local variable scoping rules in C# in general. First, the bug. The Bug Consider the following code: class C { static void Main( string [] args) { foreach (...
on
7 Nov 2007
Page 1 of 1 (1 items)