Frage

I need to delay some piece of code from processing for some time in Microseconds. I tried a lots of things such as thread.Sleep(x), but it has only milliseconds resolution.

I am using .NET 2.0 in MS Visual Studio 2013.

War es hilfreich?

Lösung

 System.Diagnostics.Stopwatch

allows you to get very small (few nanosecond) ticks, which you can convert to microseconds using this. Then you can just let an empty while loop for as long as you need.

Edit: and it even is supported by .NET 2.0.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top