O'Reilly logo

Visual Basic 2010 Unleashed by Alessandro Del Sole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Coding New Types

One of the most important new features in the Visual Studio 2010 IDE is the ability to generate on-the-fly objects that do not exist yet. This feature is known as Generate From Usage. To understand how it works, simply create a new Console application named GenerateFromUsage and within the Main method type the following code:

image

Because the Person class has not been implemented, the Visual Basic compiler throws an exception, offering the usual pop-up button that suggests solutions. But with Visual Basic 2010 things change; now you have additional solutions, as shown in Figure 18.1.

Figure 18.1 New error correction options for Visual ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required