DOH!, Pause = Thread.Sleep(42)

So I’ve been working with .Net for years and today I put something together that made me feel foolish for not already realizing. Especially since I’ve used Threads before and even timed them out. I just never had the concept of needing to pause my code bump up next to the fact that my “normal” code is in a thread too.  I’ve gotten so used to only dealing with threading stuff in special situations I guess I forget that my everyday code is threading too. So if you want to pause your code for a certain number of milliseconds do this

     System.Threading.Thread.Sleep( milliseconds );


    DateTime stop = DateTime.Now.AddMilliseconds( milliseconds );
    while( DateTime.Now < stop );

Or some other machination with DateTimes and loops.

Oh well, it not really my fault it is simply a side affect of global warming.