soulfree

C# StopWatch 본문

프로그램

C# StopWatch

>동네청년< 2014. 4. 29. 22:15
using System.Diagnostics;

 

... 

  
 
Stopwatch stwatch = new Stopwatch();
  
stwatch.Reset();

 

stwatch.Start();
  
// 코드

 

stwatch.Stop();

 

 

*실버라이트의 경우

 

long before = DateTime.Now.Ticks;
DoTheTaskThatNeedsMeasurement();
long after = DateTime.Now.Ticks;

TimeSpan elapsedTime = new TimeSpan(after - before);
MessageBox.Show(string.Format("Task took {0} milliseconds",
    elapsedTime
.TotalMilliseconds)); 

0 Comments
댓글쓰기 폼