August 2010
Intermediate to advanced
1224 pages
34h 17m
English
In the later versions of Visual Basic and C# (2008 and beyond), you can define variables without explicitly setting their data type. And, when doing so, you can still get the benefits of strongly typed variables (compiler checking, memory allocation, and more). The compilers actually infer the data type you intend to use based on your code. This process is called local type inference, or implicit typing.
As an example, consider the following lines of code. Here you create a variable of type String and assign a value.
C#
string companyName = "Contoso";
VB
Dim companyName As String = "Contoso"
Now, let’s look at the same line of code using type inference. You can see that you do not need the string ...