Among Visual Basic 2008's new features is the concept of closures. These allow programmers to access environments like locals, parameters and methods from more than one function. As Jared Parsons, a developer on the Visual Basic compiler and debugger, put it in a recent blog entry, "Closures are the underpinnings for several new features in Visual Basic  They are part of the guts of Lambda and Query expressions."
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
Parsons recently penned a five-part series that introduces programmers to closures in Visual Basic 2008.
Closures in VB, Part 1 explains how the compiler is able to make a variable available to more than one function. It is a process called "lifting the variable," Parsons notes.
Closures in VB, Part 2: Method Calls looks at the two types of method calls that closures tend to handle -- those that share a method or methods on a module and those that instantiate members of a class.
Closures in VB, Part 3: Scope discusses what happens when variables are lifted from different scopes. "The answer is that one closure class will be created for every unique scope where a lifted variable is declared and all of the variables in that scope that are lifted will be placed in that closure," Parsons indicates.
Closures in VB, Part 4: Variable Lifetime shows how, and why, the lifetime of a variable is tied to its scope. This was done so Visual Basic 2008 could support lambda expressions, he states.
Closures in VB, Part 5: Looping goes into some of the "unintended consequences" programmers may encounter when simultaneously using looping structures and lambda expressions and explains how to combat these problems.
Finally, for more insight into the new features of VB 2008, check out the Visual Basic 2008 tag on the VB Team blog.
Visual Basic language apps find new life through automated conversion