Example #1
0
 public static ExcuteResult <T> Excute <T>(Func <T> action)
 {
     try
     {
         var result = action();
         return(ExcuteResult <T> .CreateSuccess(result));
     }
     catch (Exception ex)
     {
         return(ex);
     }
 }
Example #2
0
        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);
            }
        }