Pregunta

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.

¿Fue útil?

Solución

 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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top