Why is NaN (not a number) only available for doubles?

后端 未结 2 1685
花落未央
花落未央 2020-12-03 04:09

I have a business class that contains two nullable decimal properties. A third property returns the result of multiplying the other two properties. If HasValue is true for t

2条回答
  •  一生所求
    2020-12-03 04:47

    To resolve NAN & Infinity use this

    if (Double.IsNaN(YourValue) || Double.IsInfinity(YourValue))
    {
        YourValue = 0;
    }
    

提交回复
热议问题