mike mcintyre's

.N e t J o u r n a l

This blog hosted by:
http://blogs.vbcity.com      
  Home :: Syndication  :: Login

DecJanuary 2008Feb
SMTWTFS
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789

Archives

Topics

Source Code

Saturday, January 12, 2008 #

Local type inference is an important new concept to grasp as one approaches Visual Basic 2008.  Many new features in VB 2008 are dependent on it. Below is a brief introduction to local type inference followed by a link to a MSDN resource where you can learn more.

Introduction

In Visual Basic 2008 you can get strongly typed local variables without using the 'As' clause to explictly set the variables type.  Here is an example of declaring a strongly typed variable in prior versions of Visual Basic for .NET and assigning it an integer literal:

Dim myInteger As Integer = 10

In Visual Basic 2008 you can get the same result - that is a strongly type variable - like this:

Dim myInteger = 10

The Visual Basic 2008 complier will strongly type the myInteger variable by infering the type from the integer literal.  It analyzes the value assigned to the local variable myInteger  (the integer literal 10), determines it is of type integer, and strongly types myVariable as in integer.

More Information

For more info click -> Local Type Inference

posted @ 9:05 AM