Local Type Inference Scope

The word local in the Local Type Inference definition has a special meaning. Local type inference works only with local variables defined within code blocks, whereas it does not work with class-level declarations. For example, consider the following code:

image

Local type inference affects the completeName local variable, which is enclosed within a method. Now consider the following code:

image

The preceding code will not be compiled because local type inference does not affect class-level declarations; therefore, the Visual Basic ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.