以下代码给了我上面标题所示的错误:
TimeSpan my_hours = new TimeSpan();
my_hours = TimeSpan.Parse("00:00");
my_hours += TimeSpan.Parse("25:07"); //this line throws error
Run Code Online (Sandbox Code Playgroud)
就在最后一行运行之前,my_hours 的值为 4.01:33:00。我该如何解决这个错误?
基本上,这段代码在 for 循环中运行,并且值“25:07”不断变化,并添加到 my_hours 中,并一直这样做,直到当 my_hours 的当前值为 4.01:33 时,它尝试添加此值“25:07” :00 并抛出错误。
| 归档时间: |
|
| 查看次数: |
7768 次 |
| 最近记录: |