I wanted to replace a counter based while loop with the timer based while loop in C#.
Example :
while(count < 100000) { //do something }
What about using the Stopwatch class.
using System.Diagnostics; //... Stopwatch timer = new Stopwatch(); timer.Start(); while(timer.Elapsed.TotalSeconds < Xseconds) { // do something } timer.Stop();