i am trying to create an application which incorporates the use of the stopwatch class.
Stopwatch sw = new Stopwatch();
sw.Start();
while (play)
{
long timer = sw.ElapsedMilliseconds;
Debug.WriteLine(timer);
}
When i tested this loop and checked the elapsed time, i discovered that the program is missing some milliseconds.
some clockings from the debugger output:
31
32
33
34
35
36
37
38
40 <------39 missed
41
42
43
Any suggestions on how i can solve this issue?