October 2010
Intermediate to advanced
1920 pages
73h 55m
English
Here’s a feature that makes C# and VB.NET look much more like a dynamic language such as JavaScript: local variable type inference. When you take advantage of type inference, you allow the C# or VB.NET compiler to determine the type of a variable at compile time.
Here’s an example of how you use type inference with C#:
var message = "Hello World!";
And here is how you would use type inference with VB.NET:
Dim message = "Hello World!"
The message variable is declared without specifying a type. The C# and VB.NET compilers can infer the type of the variable (it’s a String) from the value you use to initialize the variable. No performance impact results from using type inference. (The variable is not late bound.) The ...