Using Stopwatch in C#
Aug 26, 2021
Hello,
The Stopwatch object used to measure the time of the transactions performed.
Example:
using System;using System.Diagnostics;
namespace ConsoleAppDemo{class Program{static void Main(string[] args){Stopwatch sw;sw = Stopwatch.StartNew();for (int i = 0; i < 10; i++){ Console.WriteLine("Elapsed Milliseconds: " + sw.Elapsed.TotalMilliseconds);}Console.WriteLine("Elapsed Milliseconds: " + sw.Elapsed.TotalMilliseconds);sw.Stop();Console.ReadLine();}}}