Implicitly Typed Variables in .Net 3.5

By Awadhesh Singh Nov 14, 2012
Implicitly Typed Variables in .net 3.5
Implicitly Typed Variables in .net 3.5
 
We can now declare a variable and allow the compiler to determine the type of the item implicitly. We will find that LINQ (Language Integrated Query) uses this capability to work with the queries that are created. To work with this new capability, you use the var keyword:
 
var x = 5;
 
When we use above statement, the compiler will actually use the value of 5 to figure out the type that this needs to be. That means, in this case, that the statement will actually be as we would expect:
 
int x = 5;
COMMENT USING

PREMIUM SPONSORS

Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.

Latest Blogs