14
Comments
  • 2
    CTRL + E, CTRL + D
    automatically resolves any var keywords in my code to what they should be.
    That way I can be lazy and have proper code!
  • 8
    I think using var in C#, the new Java versions and so on makes total sense. Why would you want to write

    ArrayList<Type> list = new ArrayList<Type>()

    ... instead of

    var list = new ArrayList<Type>()

    With var it is way more readable imo.
  • 6
    @Haxk20 Yeah your right, let's just pollute the code with half a trillion redundant type declarations like this:

    Dictionary<KeyValuePair<string, int>, List<Func<User, bool>>>

    Instead of just using var. Real bright idea.

    Or for example why would you use:

    List<int> someList = new List<int>()

    Instead of

    var someList = new List<int>()

    It's so much more readable.
  • 1
    I like watching Java developers being against this simple improvement. So many Aspergers and Stokholm syndrome victims.

    You know what? It’s actually hard to find a modern, statically typed, oo language which doesn’t have variable type inference. Even C++ introduced it in c++11.
  • 0
    @Haxk20 I know where you come from, when I say a first intro to var I too was like "Yeah I'm not gonna use that". But now I can't live without it:)
  • 1
    Update to what my comment says:
    I now use var on instantiated things like List<T>, as it says

    var list = new List<string>();

    anyway already.
Add Comment