programming-examples/c-sharp/Events/C# Program to Create Stop Watch.cs
2019-11-15 12:59:38 +01:00

25 lines
589 B
C#

/*
* C# Program to Create Stop Watch
*/
using System;
using System.Diagnostics;
using System.Threading;
class Program
{
static void Main()
{
// Create new stopwatch
Stopwatch stopwatch = new Stopwatch();
// Begin timing
stopwatch.Start();
for (int i = 0; i < 10; i++)
{
Console.WriteLine("HI");
}
// Stop timing
stopwatch.Stop();
Console.WriteLine("Time Elapsed : {0}",
stopwatch.Elapsed);
Console.ReadLine();
}
}