在 C# 中精确表示无时间

csharpprogrammingserver side programming更新于 2025/9/1 9:52:17

使用 TimeSpan.Zero 表示无时间的精确表示,即 −

00:00:00

设置 TimeSpan 的对象 −

TimeSpan ts;

现在,TimeSpan.Zero 用于显示无时间 −

TimeSpan ts = TimeSpan.Zero;

示例

using System;
using System.Linq;
public class Demo {
   public static void Main() {
      TimeSpan ts = TimeSpan.Zero;
      Console.WriteLine(ts);
   }
}

输出

00:00:00

相关文章