The first feature that is very important for LINQ is the
var. This is a keyword of C# 3.0 that can be used to declare a variable and this variable can be initialized to any valid C# datatype. It is basically an un-typed object or an object without type until it is initialized.
In the C# 3.0 specification, such variables are called implicitly-typed local variables.
var variable must be initialized when it is declared. The compile-time type of the
initializer expression must not be of the
null type, but the runtime expression can be
null. Once it is initialized, its datatype is fixed to the type of the initial data.
The following statements are valid uses of the
// valid var statements var x = "1"; var n = 0; string ...