Duplicate
Use of var keyword in C#
C# - Do you use "var"?
Should I always favour implictly typed local variables in C# 3.0?
Would you prefer to write your code like this:
var myVar = new MyClass();
or
MyClass myVar = new MyClass();
I don't object to use the var
keyword in example above; however, in the code below I don't like the usage of var
.
var files = Files.GetFiles();
In this example it's not obvious what type variable files
is going to be.
What's your preference for using the var
keyword?