Alternatives to nullable types in C#

后端 未结 6 1711
盖世英雄少女心
盖世英雄少女心 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:12

    Maybe the significant performance decrease happens when calling one of Nullable's members or properties (boxing).

    Try to use a struct with the double + a boolean telling whether the value is specified or not.

提交回复
热议问题