Thread.Sleep(new TimeSpan(0, 0, 0, 10, 0));
Thankfully there are a number of static convenience functions that take the single value and return a TimeSpan. They are all in form of FromX(double) where X maps to the same days, hours, minutes, seconds and milliseconds as above. So instead of the code above we can write:
Thread.Sleep(new TimeSpan.FromSeconds(10));
Nothing Earth shattering but just a little bit clearer for the next person who reads the code.
No comments:
Post a Comment