且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法将类型“十进制"隐式转换为“字符串"

更新时间:2023-11-05 09:28:10

只需调用ToString即可获取十进制值的字符串表示形式:

Just call ToString to get a string representation of the decimal value:

order.Total = orderTotal.ToString("G");

尽管我不明白为什么将成员Total存储为string而不存储为decimal.

Although I don't see why you would store the member Total as a string and not as a decimal too.