【发布时间】:2022-06-16 21:34:06
【问题描述】:
我有 "somemethod()" 计算并返回 null double。 我想将它四舍五入到最近的整数并分配给可为空的整数变量
//查看fund是可以为空的整数
int? fund;
fund = Math.Round(somemethod(), 0);
// 方法做一些计算。但是返回类型是可以为空的 double
private double? somemethod()
{
......
}
注意:由于逻辑原因,我必须将其声明为可为空的
【问题讨论】:
-
这能回答你的问题吗? How round double nullable type?
标签: c# asp.net-core asp.net-core-webapi