I would like to ask a theoretical question. If I have, for example, the following C# code in Page_load:
cars = new carsModel.carsEntities();
var mftQuery =
And to answer your question 1, the benefit of using var
keyword in the presented code is at may be difficult to come up with the resulting type for the LINQ query and can be easily affected by the change to the query. In fact, its introduction to C# coincide with the premiere of LINQ.
Reassuming, it is to make the life of programmer easier and also to remove the redundancy of Type t = new Type()
.