public static ExcuteResult <T> Excute <T>(Func <T> action) { try { var result = action(); return(ExcuteResult <T> .CreateSuccess(result)); } catch (Exception ex) { return(ex); } }
public static async Task <ExcuteResult <T> > ExcuteAsync <T>(Func <Task <T> > action) { try { var result = await action().DonotCapture(); return(ExcuteResult <T> .CreateSuccess(result)); } catch (Exception ex) { return(ex); } }