public static void Run(this ITrap trap, Action action) { var run = trap.StartRun(); action(); run.Stop(); }
public static T Run <T>(this ITrap trap, Func <T> func) { var run = trap.StartRun(); var returnValue = func(); run.Stop(); return(returnValue); }
public static async Task <T> Run <T>(this ITrap trap, Func <Task <T> > func) { var run = trap.StartRun(); var returnValue = await func(); run.Stop(); return(returnValue); }