Windows Phone Developers

Saturday, November 15, 2008

Type Inference in C# using var keyword

Implicitly Typed Local Variables in C#

Instead of explicitly declaring the variable of a particular type (int, short, string etc), one can define a variable of type ‘var’ and allowing the compiler to infer the type

For example,

var i = 10;

is equivalent to

int i = 10;

The inferred type may be a built-in type, an anonymous type, a user-defined type, a type defined in the .NET Framework class library, or any expression.

Implicit Typed Variables in .NET, .NET Variant, Var keyword in .NET, Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment

kbAlertz.com :: Visual Studio 2005

kbAlertz.com :: Visual Studio 2008

kbAlertz.com :: Visual Basic 2005