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:


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 ...

Get Visual Basic 2010 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.