More and more often I've been seeing C# code like this:
var Data = GetData();
What on earth does
GetData() return? This code is not as maintainable as it could be and is not as maintainable as it should be.
Doesn't explicitly declaring the variable type make the code more readable, understandable, and ultimately more maintainable?
DataTable Data = GetData();
GetData() returns a
I know that
var has uses but I wish it would have been named something much longer because typing 'var' is too easy. Perhaps it should have been named AutomaticTypeVar or even AutoVar to reduce the lazy misuse.
Just my 2 cents. [Update]
A user on the Asp.Net forums was kind enough to provide this quote and link:
"However, the use of var does have at least the potential to make your code more difficult to understand for other developers. For that reason, the C# documentation generally uses var only when it is required."