Method Sleep
Sleep(Duration)
Suspends the current thread for the specified NodaTime.Duration.
public void Sleep(Duration duration)
Parameters
durationDurationThe amount of time for which the thread is suspended. If zero or negative, the thread relinquishes the remainder of its time slice (or returns immediately).
Remarks
Implementations may clamp values: zero or negative is treated as zero; durations greater than MaxValue are clamped to MaxValue for the underlying sleep.
Sleep(TimeSpan)
Suspends the current thread for the specified amount of time.
public void Sleep(TimeSpan sleepTime)
Parameters
sleepTimeTimeSpanThe amount of time for which the thread is suspended. If the value is Zero, the thread relinquishes the remainder of its time slice to any thread of equal priority that is ready to run. If there are no other threads of equal priority that are ready to run, execution of the current thread is not suspended.
Exceptions
- ArgumentOutOfRangeException
sleepTimeis not a valid sleep interval (for example, negative and not an infinite timeout, or too large to express in milliseconds).
- See Also
Sleep(int)
Suspends the current thread for the specified number of milliseconds.
public void Sleep(int sleepMilliseconds)
Parameters
sleepMillisecondsintThe number of milliseconds for which the thread is suspended. If the value is zero, the thread relinquishes the remainder of its time slice to any thread of equal priority that is ready to run. If there are no other threads of equal priority that are ready to run, execution of the current thread is not suspended.
Exceptions
- ArgumentOutOfRangeException
sleepMillisecondsis negative and not equal to Infinite.
- See Also