To null or not to null, that is the question … #767
-
I’m considering changing Here’s my logic:
On the other hand, there’s a do-not-use nullable trend right now in C#. When did My view is that What’s your opinion on the topic? Help me learn! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
From a user:
|
Beta Was this translation helpful? Give feedback.
-
In C# numerical analysis, there are three special constants that are not used often enough: All three of them can be used in math calculations, do not raise exceptions and can be used/handled very gracefully for situations like div/0, missing data and, asymptotically small numbers. On the other hand. nulls are pure evil and should be nuked from the orbit. :-) |
Beta Was this translation helpful? Give feedback.
-
One more case in point for NaN and against null:
from dotnet documentation: For the use case of time series used in technical analysis, I prefer this behavior. If I am comparing current and previous value in the series |
Beta Was this translation helpful? Give feedback.
-
Based in feedback from users after experimenting with use of |
Beta Was this translation helpful? Give feedback.
Based in feedback from users after experimenting with use of
NaN
in version 2.0.0, we’ve limited the use of it to internal processes only in v2.0.3 to reduce user friction. The takeaway here is that most apps and systems that use our library handlenull
more gracefully thanNaN
, especially when translating result values into 3rd party visualization tools.