Alternatives to nullable types in C#

后端 未结 6 901
时光说笑
时光说笑 2021-02-07 15:50

I am writing algorithms that work on series of numeric data, where sometimes, a value in the series needs to be null. However, because this application is performance critical,

6条回答
  •  梦谈多话
    2021-02-07 16:08

    Partial answer:

    Float and Double provide NaN (Not a Number). NaN is a little tricky since, per spec, NaN != NaN. If you want to know if a number is NaN, you'll need to use Double.IsNaN().

    See also Binary floating point and .NET.

提交回复
热议问题