在 C# 中表示確切的無時間表示


使用 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

更新於: 2020-6-22

77 次瀏覽量

開啟您的職業生涯

完成課程並獲得認證

開始
廣告
© . All rights reserved.