|
|
|
|
|
by enlightens
317 days ago
|
|
from your sibling comment:
> "var" also makes your code less reliable as seen in this example I disagree with this too, I think your example is a classic case of preprocessor directives making it difficult to know what your code is doing because the build system is going to conditionally change your code. Var or not, you can't even know what's being compiled just by looking at the file, and that's a larger problem than the use of var https://learn.microsoft.com/en-us/dotnet/csharp/language-ref... |
|
I have seen code that sorts numbers as strings, because nowhere in the code was the intent stated that the array is supposed to hold numbers. As a result, if the programmer forgot to convert strings to integers at input time, the bug is never caught.
See: https://circles.page/567f44465c28b00bf8ed6cf9/Csharp-type-in...