Measuring Execution Time in C#

By sunilmallya

DateTime startTime = DateTime.Now;

Function(){}

DateTime EndTime = DateTime.Now;

TimeSpan TotalTime= EndTime – StartTime ;

 TotalTime.ToString();  // to display in some Label/ Textbox

Leave a Reply