0 c# formatting type-conversion mvvm windows-phone-7
我有一个方法,并希望将结果转换为具有特定格式的字符串.这是我的代码:
private double MinimunWeight()
{
return 18.5 / Math.Sqrt(Evaluation.Height).ToString("0.0");
}
Run Code Online (Sandbox Code Playgroud)
它无法编译:
运算符'/'不能应用于'double'和'string'类型的操作数
实现这一目标的正确方法是什么?
你是这个意思?
private string MinimunWeight()
{
return (18.5 / Math.Sqrt(Evaluation.Height)).ToString("0.0");
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
80 次 |
最近记录: |