Also: some people really oppose "var." I don't understand why, especially when newer languages like Swift and Rust really encourage similar idioms. Something something = new Something () is usually a smell to me. I personally find "var" much easier to work with.
var something = new Something()
... this one in C# is probably using type inference? Or maybe it doesn't matter in C# because it has a dynamic type anyways? Yes, Rust permits type inference but sometimes it can't infer it and you have to specify it. And sometimes it's clearer to be explicit about the type. C++ permits it too (auto) but depending on the team it can be pretty unpopular except for maybe verbose type names/iterator types, etc. var x = new Foo()
C# should have fewer, better considered features imo.Or maybe just because C# is a TIMTOWTDI language?
C# looks indeed quite baroque to me. But as I'm not doing any C# I don't know whether this is a good or a bad thing in practice.
OTOHS I guess less complexity in a language is generally to be preferred compared to having more flexibility doing the same thing.
I don't have any F# experience, but I have done some Haskell back in the days and I found the type inference very convenient. But I also think there is something to be said for limiting type inference to "inside" methods where it is effectively invisible to users of a class. Rust has made the same choice: you have type inference inside functions, but never outside.
From msdn/dotnet documentation:
> The use of var helps simplify your code, but its use should be restricted to cases where it is required, or when it makes your code easier to read.
https://docs.microsoft.com/en-us/dotnet/csharp/programming-g...
Also, C# 9.0 introduces target-typed new expressions:
https://docs.microsoft.com/en-us/dotnet/csharp/language-refe...
The argument that code becomes unreadable without an IDE is only true if identifiers aren't named properly (for example by heavy abuse of abbreviations, or even the usage of single-letter symbols).
The only places where type-inference should be avoided are "public interface" kind of things. It's best practice to be explicit about an "interface"—even in languages with full type inference. This avoids changing an interface unnoticed only by changing an expression somewhere. (I don't mean here C#'s Interfaces verbatim, but for example signatures of "package public" methods and such).