Welcome to MSDN Blogs Sign in | Join | Help

August 2008 - Posts

Variable scope in C#

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
Posted by sferg | 7 Comments
 
Page view tracker