Ejemplo n.º 1
0
 /// <summary>
 /// Wraps <paramref name="selector"/> in a <see cref="Step"/> call and executes it, returning its result.
 /// </summary>
 /// <param name="profiler">The current profiling session or null.</param>
 /// <param name="selector">Method to execute and profile.</param>
 /// <param name="name">The <see cref="Timing"/> step name used to label the profiler results.</param>
 /// <returns></returns>
 public static T Inline <T>(this MiniProfiler profiler, Func <T> selector, string name)
 {
     if (selector == null)
     {
         throw new ArgumentNullException("selector");
     }
     if (profiler == null)
     {
         return(selector());
     }
     using (profiler.StepImpl(name))
     {
         return(selector());
     }
 }