top | item 28196565

(no title)

snak | 4 years ago

The problem is people abuse of "var", and use it everywhere even when the type is not obvious from the right-hand expression/assignment. This is especially bad when reading code outside of an IDE, like in a GitHub PR, git/cli tools, etc...

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...

discuss

order

No comments yet.