public static async Task <MethodResult <TResult> > TryMapAsync <TSource, TResult>(
            this Task <TSource> @this,
            Func <TSource, MethodResult <TResult> > function
            )
        {
            var t = await @this;

            return(TryExtensions.Try(() => function(t)));
        }
Пример #2
0
 public static MethodResult <TSource> TryTeeUsing <TSource, TResult>(
     this TSource obj,
     Func <TSource, TResult> function) where TSource : IDisposable =>
 TryExtensions.Try(() => obj.TeeUsing(function));
Пример #3
0
 public static MethodResult <T> TryTeeUsing <T>(
     this T obj,
     Action <T> action) where T : IDisposable =>
 TryExtensions.Try(() => obj.TeeUsing(action));
Пример #4
0
 public static MethodResult <T> TryOperateWhen <T>(
     this T @this,
     bool predicate, Action action) =>
 @this.OperateWhen(predicate, () => TryExtensions.Try(action));
Пример #5
0
 public static MethodResult <T> TryOperateWhen <T>(
     this T @this,
     Func <bool> predicateFun,
     Func <T, MethodResult <T> > function
     ) => TryExtensions.Try(predicateFun)
 .OnSuccess(predict => @this.OperateWhen(predict, function));
Пример #6
0
 public static MethodResult TryOperateWhen(
     Func <bool> predicateFun, Action action) =>
 TryExtensions.Try(predicateFun)
 .OnSuccess(predict => TryOperateWhen(predict, action));
Пример #7
0
 public static MethodResult TryOperateWhen(
     bool predicate, Action action) =>
 OperateWhen(predicate, () => TryExtensions.Try(action));
 public static MethodResult <TResult> TryMap <TSource, TResult>(
     this TSource @this,
     Func <TSource, MethodResult <TResult> > function) =>
 TryExtensions.Try(() => function(@this));
 public static MethodResult <TResult> TryMapMethodResult <TResult>(
     this MethodResult @this,
     Func <TResult> onSuccessFunction,
     Func <ResultDetail, TResult> onFailFunction
     ) => TryExtensions.Try(() => @this.MapMethodResult(onSuccessFunction, onFailFunction));
 public static Task <MethodResult> TryTeeOnSuccessAsync(
     this Task <MethodResult> @this,
     Action action) => @this
 .OnSuccessAsync(() => TryExtensions.Try(action));
 public static MethodResult <TResult> TryMap <TSource, TResult>(
     this TSource _,
     Func <TResult> onSuccessFunction
     ) => TryExtensions.Try(onSuccessFunction);
 public static MethodResult TryTeeOnSuccess(
     this MethodResult @this,
     Action action) => @this
 .OnSuccess(() => TryExtensions.Try(action));
 public static MethodResult TryTee(Action?action) =>
 TryExtensions.Try(() => TeeExtensions.Tee(action));
 public static MethodResult <T> TryTee <T>(
     this T @this,
     Action?action) => TryExtensions.Try(() => @this.Tee(action));
 public static MethodResult TryTee <TResult>(
     Func <TResult> function) => TryExtensions.Try(() => TeeExtensions.Tee(function));
 public static MethodResult <TSource> TryTee <TSource, TResult>(
     this TSource @this,
     Func <TResult> function) => TryExtensions.Try(() => @this.Tee(function));