Re:Programming Idioms
by snak on Monday August 16, 2021 @06:20AM
(#28196565)
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.
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...