本文整理匯總了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));
}
示例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())
{
}