當前位置: 首頁>>代碼示例>>C#>>正文


C# Duration.TotalMilliseconds方法代碼示例

本文整理匯總了C#中System.Duration.TotalMilliseconds方法的典型用法代碼示例。如果您正苦於以下問題:C# Duration.TotalMilliseconds方法的具體用法?C# Duration.TotalMilliseconds怎麽用?C# Duration.TotalMilliseconds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Duration的用法示例。


在下文中一共展示了Duration.TotalMilliseconds方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TimeOuts

 /// <summary>
 /// Initializes a new instance of the <see cref="TimeOuts" /> class.
 /// </summary>
 /// <param name="period">The period.</param>
 /// <param name="dueTime">The due time.</param>
 /// <param name="minimumGap">The minimum gap.</param>
 /// <param name="timeStamp">The time stamp.</param>
 /// <param name="dueTimeStamp">The due time stamp.</param>
 public TimeOuts(
     Duration period,
     Duration dueTime,
     Duration minimumGap,
     long timeStamp,
     long? dueTimeStamp = null)
 {
     TimeStamp = timeStamp;
     DueTimeMs = dueTime < Duration.Zero ? -1 : (int)dueTime.TotalMilliseconds();
     MinimumGapMs = minimumGap < Duration.Zero ? -1 : (int)minimumGap.TotalMilliseconds();
     PeriodMs = period < Duration.Zero
         ? -1
         : (period < MinimumPeriod ? MinimumPeriodMs : (int)period.TotalMilliseconds());
     DueTimeStamp = dueTime < Duration.Zero
         ? long.MaxValue
         : (dueTimeStamp ?? TimeStamp + (DueTimeMs * NodaConstants.TicksPerMillisecond));
 }
開發者ID:webappsuk,項目名稱:CoreLibraries,代碼行數:25,代碼來源:AsyncTimer.cs

示例2: BufferedAction

 /// <summary>
 /// Initializes a new instance of the <see cref="BufferedAction" /> class.
 /// </summary>
 /// <param name="action">The action.</param>
 /// <param name="duration">The duration is the amount of time the result of a successful execution is held, after the point a successful request was made.</param>
 /// <exception cref="ArgumentNullException"><paramref name="action"/> is <see langword="null" />.</exception>
 /// <exception cref="ArgumentOutOfRangeException"><paramref name="duration"/> is less than or equal to zero.</exception>
 public BufferedAction(
     [NotNull] Action<object[][]> action,
     Duration duration)
     : this(action, (long)duration.TotalMilliseconds())
 {
 }
開發者ID:webappsuk,項目名稱:CoreLibraries,代碼行數:13,代碼來源:BufferedAction.cs


注:本文中的System.Duration.TotalMilliseconds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。