我不確定這裏發生了什麼,但它會接受一些時間段,但不接受其他時間段。有人能告訴我一種方法來檢查這種格式99:59:59的時間跨度。TimeSpan不會解析某些字符串
//50:30:00 is bad
//50:20:00 is good
try
{
TimeSpan ts = new TimeSpan();
ts = TimeSpan.Parse("50:30:00");
}
catch //(Exception ex)
{
MessageBox.Show("bad time span");
}
'50:30:00'壞,'50:20:00'好?沒有意義。 – Raptor 2013-03-25 04:30:52
[How to Parse string with hours to 24 to TimeSpan?](http://stackoverflow.com/questions/2728321/how-to-parse-string-with-hours-greater-than-24-to -timespan) – Raptor 2013-03-25 04:31:00
我看到了,但我認爲這是一個錯誤,所以我決定發佈它。 – 2013-03-25 04:32:14