Hacker News new | ask | show | jobs
by m_fayer 3504 days ago
Do you really think something like this:

Dictionary<string, Tuple<int, List<string>>> foo = new Dictionary<string, Tuple<int, List<string>>>();

Is prefferable to:

var foo = new Dictionary<string, Tuple<int, List<string>>>();

What do you get from the former that makes the eye-pain worth it?

Also, the var keyword is necessary for anonymous types if you want to hold a reference to one. And this is a language feature I sorely miss in Java-land.

1 comments

Since Java 7 you can use the "diamond operator" in such cases:

Dictionary<string, Tuple<int, List<string>>> foo = new Dictionary<>();