Blog

Implicitly Typed Variables in .Net 3.5

Posted by Awadhesh Singh Blogs | C# Language 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;
comments
COMMENT USING
PREMIUM SPONSORS
Infragistics is experts in technology and design, and passionate about helping you build highly performant and stylish applications that solve problems, deliver inspiration, and maximize results.
Nevron Chart
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.