Esempio n. 1
0
        public static Task WaitAsync(TimeSpan duration, CancellationToken cancellationToken)
        {
            ThrowIf.OutOfRange(duration, TimeSpan.Zero, TimeSpan.MaxValue, "duration");
            int durationInMilliseconds;

            if (duration.TotalMilliseconds > int.MaxValue)
            {
                durationInMilliseconds = -1;
            }
            else
            {
                durationInMilliseconds = (int)duration.TotalMilliseconds;
            }

            return(Task.Delay(durationInMilliseconds, cancellationToken));
        }
Esempio n. 2
0
        public EnumerationWrapper(PropertyEnumerationResult enumerationResult)
        {
            ThrowIf.Null(enumerationResult, "enumerationResult");

            this.enumerationResult = enumerationResult;
        }
Esempio n. 3
0
 public static T NextFromTimestamp <T>(T[] values)
 {
     ThrowIf.Null(values, "values");
     return(values[RandomUtility.NextFromTimestamp(values.Length)]);
 }
Esempio n. 4
0
 public static int NextFromTimestamp(int maxValue)
 {
     ThrowIf.OutOfRange(maxValue, 1, int.MaxValue, "maxValue");
     return(((int)Stopwatch.GetTimestamp() & 0x7FFFFFFF) % maxValue);
 }