我有以下代码:
var point = TimeSpan.ParseExact(input, "hh\\:mm\\:ss\\,fff", CultureInfo.InvariantCulture);
我的输入格式是:
00:00:15,680
我知道这很容易。但我总是得到以下错误:
System.FormatException: 'String was not recognized as a valid TimeSpan.'
那么我做错了什么?你能帮我完成我的具体任务吗?实际上我已经尝试过这么多格式,但不幸的是没有人是正确的。
根据ParseExact定义,语法为:
input format
等
System.FormatException
异常消息是关于input
参数,该参数是函数原型中列表中的第一个参数。我会仔细检查代码中input
参数的值。