我正在尝试转换以下格式的字符串:30,500转换为浮点数30.500(在 json 中)所以目前我有类似的东西float.Parse(string.Format("{0:00,000}", inp_km.Text), CultureInfo.InvariantCulture.NumberFormat),但是当我将它保存在 json 中时,它会另存为30500.00.
我在这里做错了什么?
我是如何做到的;
我从类中制作了一个对象,Results就像这里一样;
team_results = new Results()
{
team_number = selected_team.team_number,
results = new Result[2] { new Result{ }, new Result { } }
};
现在,当我将新值添加到 json(下面的示例)时,我得到的输入是 30,500
[
{
"team_number": 101,
"results": [
{
"given_start_time": "20:25",
"connection_to_start": "0:00",
"start_kp": "20:26",
"stop_kp": "0:0",
"missed_controls": 0,
"km": 0.000,
"gtks": [ "25:00", "30:15", "0:00" ]
},
{
"given_start_time": "21:56",
"connection_to_start": "0:00",
"start_kp": "21:57",
"stop_kp": "0:0",
"missed_controls": 0,
"km": 0.000,
"gtks": [ "25:00", "30:15" ]
}
]
}
]
但是当它保存时,它会保存为 30500.00
呼唤远方
饮歌长啸
慕莱坞森
相关分类