METHOD
Stopwatch.GetElapsedTime
Converts timestamps from Stopwatch into elapsed time. The raw timestamp units depend on the timer frequency, not necessarily TimeSpan ticks. This API alone is not a benchmark methodology.
Formal Syntax & Structure
csharp syntaxcsharp
Stopwatch.GetElapsedTime(start,end)Working Example
Example Snippetcsharp
using System;using System.Linq;using System.Diagnostics;using System.Diagnostics.Metrics;long start=Stopwatch.GetTimestamp(); Console.WriteLine(Stopwatch.GetElapsedTime(start,start)==TimeSpan.Zero); // True