我需要显示在控制台中运行的计时器。我使用秒表:
System.Diagnostics.Stopwatch 秒表 = new System.Diagnostics.Stopwatch();
public void startTime()
{
stopwatch.Start();
}
public void GetTime(){
stopwatch.Stop();
TimeSpan timeSpan = stopwatch.Elapsed;
var timeElapsed = (string.Format("\nTime Elapsed: {0} minute(s) {1} second(s)",
timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds / 10 + "\n")).ToString();
}
我需要在控制台中显示计时器正常运行:00:00:01、00:00:02、00:00:03 ... 等
我怎样才能做到这一点?