why can't you assign a number with a decimal point to decimal type directly without using type suffix?

前端 未结 5 1981
借酒劲吻你
借酒劲吻你 2021-02-02 05:40

Why can\'t you assign a number with a decimal point to the decimal type directly without using type suffix? isn\'t this kind of number considered a number of type decimal?

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-02 06:07

    See the MSDN page on decimal which explains that there is no implicit conversion between normal float types and decimal.

    Try

    decimal bankBalance = 3433.20m;

提交回复
热议问题