Operator '*' cannot be applied to operands of type 'double' and 'decimal'

前端 未结 4 2016
北荒
北荒 2020-12-07 00:39

I get this message in my program but i don\'t know how to fix it i have search on the net but don\'t find any thing that can help me.

private double Price;
p         


        
4条回答
  •  一整个雨季
    2020-12-07 00:48

    You can't multiply a decimal by a double. You can fix this by type casting, but you probably just want to stick with using decimal for all prices and VAT rates throughout.

    The type decimal was designed to be useful for financial calculations since it offers high precision at the cost of reduced range for the size of the type in bytes.

提交回复
热议问题