本文整理匯總了C#中System.TimeSpan.TotalMilliseconds屬性的典型用法代碼示例。如果您正苦於以下問題:C# TimeSpan.TotalMilliseconds屬性的具體用法?C# TimeSpan.TotalMilliseconds怎麽用?C# TimeSpan.TotalMilliseconds使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.TimeSpan
的用法示例。
在下文中一共展示了TimeSpan.TotalMilliseconds屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TimeSpan
// Define an interval of 1 day, 15+ hours.
TimeSpan interval = new TimeSpan(1, 15, 42, 45, 750);
Console.WriteLine("Value of TimeSpan: {0}", interval);
Console.WriteLine("There are {0:N5} milliseconds, as follows:", interval.TotalMilliseconds);
long nMilliseconds = interval.Days * 24 * 60 * 60 * 1000 +
interval.Hours *60 * 60 * 1000 +
interval.Minutes * 60 * 1000 +
interval.Seconds * 1000 +
interval.Milliseconds;
Console.WriteLine(" Milliseconds: {0,18:N0}", nMilliseconds);
Console.WriteLine(" Ticks: {0,18:N0}",
nMilliseconds * 10000 - interval.Ticks);
輸出:
Value of TimeSpan: 1.15:42:45.7500000 There are 142,965,750.00000 milliseconds, as follows: Milliseconds: 142,965,750 Ticks: 0