decimal total = 0;
if(book != null && book.Price.HasValue)
{
total = (decimal)0.01 * book.Price.Value;
}
//tip 0.01 应该使用(decimal)0.01进行转换,然后进行* 运算,这样可以成功赋值
2021.7.18
decimal total = 0;
if(book != null && book.Price.HasValue)
{
total = (decimal)0.01 * book.Price.Value;
}
//tip 0.01 应该使用(decimal)0.01进行转换,然后进行* 运算,这样可以成功赋值
2021.7.18