Its been few months that I am using Razor as a view engine in my ASP.NET MVC applications and I am using variable like:
string myVariable = "My Variable String";
Or this:
int count = 0;
But today i find out that we should only declare variable with var keyword.
Variables are declared with the var keyword according to w3school and All the variable in official asp.net razor documentation, they are using var keyword in razor documentation example.
So my questions are:
What is the benefit of using var keyword instead of explicitly specifying the type of the variable?
As I told you, I am using string and int type variable, am I doing wrong?