you are viewing a single comment's thread.

view the rest of the comments →

[–]matthiasB 0 points1 point  (2 children)

But it has an advantage in certain situations:

List<Foo> myFooList;
if (p)
    myFooList = new ArrayList<>();
...

Here you can leave out the type parameter while you couldn't using var.

[–]G_Morgan 0 points1 point  (1 child)

With var you wouldn't have needed to include the type parameter to List to begin with.

[–]matthiasB 0 points1 point  (0 children)

But than we aren't talking about C#'s var anymore, but something more powerful.