In C#, am I encouraged to use the all-purpose var keyword for every variable declaration? If yes, do I have to mention those special characters for literal values within the variable declaration like the M for decimal in the following statement:

var myDecimal = 14.5M;


If it makes a difference, I'm trying to do some web development with C#.

There has been a lot of dispute over the use of var. My general rules are the following.


When the type is obvious such as when the right hand of the assignment is a constructor, use var.
When the type is complex to write, such as a LINQ query (the reason for var in the first place) use var.
For ambivalent types (your Decimal being an example) where you want to make sure that your variable is correctly typed, spell it out.
Anonymous types have to use var.
In all other cases spell out the type.


Basically, the goal is to make it easier to read the code. If you feel that var suffices because the assignment is obvious, use var. Use the full type name as a hint for the reader when you feel it's necessary.
