/// <summary> /// Measures the elapsed time taken by an code block. /// </summary> /// <param name="executionBlock">Delegate to the code block which will be executed by this method and its elapsed will be measured</param> /// <returns>The <see cref="TimeSpanStatistics"/> object contains the elapsed time of the execution</returns> static public TimeSpanStatistics Measure(ExecutationBlock executionBlock) { TimeSpanStatistics stat = new TimeSpanStatistics(); stat.Start(); try { executionBlock(); return stat; } finally { stat.End(); } }
/// <summary> /// Measures the elapsed time taken by an code block. /// </summary> /// <param name="executionBlock">Delegate to the code block which will be executed by this method and its elapsed will be measured</param> /// <returns>The <see cref="TimeSpanStatistics"/> object contains the elapsed time of the execution</returns> static public TimeSpanStatistics Measure(ExecutationBlock executionBlock) { TimeSpanStatistics stat = new TimeSpanStatistics(); stat.Start(); try { executionBlock(); return(stat); } finally { stat.End(); } }