Alternatives to nullable types in C#

后端 未结 6 908
时光说笑
时光说笑 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

    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.

提交回复
热议问题