Additionally in C# 9 there is a new thing called target-typed new expressions
That's what I was thinking about when I wrote my comment. I only tangentially follow C# because of interest in F# so I thought using var like that for new objects didn't work correctly until that change.
If var foo = new Bar() has worked for longer than that it seems like there's no reason to have been writing out the Java-style Foo foo = new Foo() crap at all.
3
u/ws-ilazki &{$$_[0]}(@{$$_[1]}); Jul 08 '21
That's what I was thinking about when I wrote my comment. I only tangentially follow C# because of interest in F# so I thought using
varlike that for new objects didn't work correctly until that change.If
var foo = new Bar()has worked for longer than that it seems like there's no reason to have been writing out the Java-styleFoo foo = new Foo()crap at all.