如何在C#中替换字符串格式中的double
本文关键字:格式 double 字符串 替换 | 更新日期: 2023-09-27 18:24:38
如何用double替换字符串来计算C#中下面代码中的"距离"(而不是时间)?其中距离最初为0.00。尝试在Windows Phone中通过Sqlite发布值。
private string time = string.Empty;
public string Time
{
get { return time; }
set { if (SetProperty(ref time, value)) IsDirty = true; }
}
//需要将值放在下面的行中。
internal CustomerViewModel(int id, double pace, string time, double distance )
{
this.id = id;
this.pace = pace;
this.time = time;
this.distance = distance;
this.isDirty = false;
}
我不知道我是否正确理解你的问题,但这就是你的意思吗:
private double time = 0.00;
public double Time
{
get { return time; }
set { if (SetProperty(ref time, value)) IsDirty = true; }
}
编辑:
private double distance = 0.0;
public double Distance
{
get { return this.distance; }
set {
this.distance = value;
IsDirty = true; }
}