May 2010
Intermediate to advanced
1272 pages
61h 18m
English
Local type inference is a language feature that allows you to omit specifying the data type of a local variable even if Option Strict is set to On. The Visual Basic compiler can deduce (infer) the most appropriate data type depending on the variable’s usage. The easiest way to understand and hopefully appreciate local type inference is to provide a code example. Consider the following code and pay attention to the comments:

As you can see, the code doesn’t specify the type for all variables because the compiler can infer the most appropriate data type according to the usage of a variable. To ensure that the VB compiler inferred ...
Read now
Unlock full access