本文整理汇总了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())
{
}