How can I convert decimal? to decimal

后端 未结 5 1081
-上瘾入骨i
-上瘾入骨i 2021-02-02 05:31

may be it is a simple question but I\'m try all of conversion method! and it still has error! would you help me?

decimal? (nullable decimal) to decimal

5条回答
  •  無奈伤痛
    2021-02-02 05:59

    You can use.

    decimal? v = 2;

    decimal v2 = Convert.ToDecimal(v);

    If the value is null (v), it will be converted to 0.

提交回复
热议问题