programming-examples/c-sharp/Games_&_Threads/C# Program to Implement Sleep method of Thread.cs

24 lines
664 B
C#
Raw Normal View History

2019-11-15 12:59:38 +01:00
/*
* C# Program to Implement Sleep method of Thread
*/
using System;
using System.Diagnostics;
using System.Threading;
class Program
{
static void Main()
{
var stopwatch = Stopwatch.StartNew();
Thread.Sleep(500);
stopwatch.Stop();
Console.WriteLine("Elapsed Milliseconds : {0}",stopwatch.ElapsedMilliseconds);
Console.WriteLine("Elapsed Ticks : {0}", stopwatch.ElapsedTicks);
Console.WriteLine("Present Date and Time : {0}",DateTime.Now.ToLongTimeString());
Console.ReadLine();
}
}
/*
Elapsed Milliseconds : 498
Elapsed Ticks : 1231409
Present Date and Time : 8:36:06 PM