Alternatives to nullable types in C#

后端 未结 6 1729
盖世英雄少女心
盖世英雄少女心 2021-02-07 15:44

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:09

    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.

提交回复
热议问题