コード例 #1
0
 public static Task <Result <T> > Bind <T>(this Task <Result> sourceTask,
                                           Func <CancellationToken, Task <T> > asyncFactory, CancellationToken cancellationToken)
 => sourceTask
 .ContinueWith(task => task.Exception == null
             ? task.IsCanceled
                 ? FailFactory.GenericCanceledTask <T>(task)
                 : task.Result.Bind(asyncFactory, cancellationToken)
             : FailFactory.GenericExceptionTask <T>(task.Exception))
 .Unwrap();
コード例 #2
0
 public static Task <Result <TMapped> > Bind <T, TMapped>(this Task <Result <T> > sourceTask,
                                                          Func <T, Task <TMapped> > asyncMapper)
 => sourceTask
 .ContinueWith(task => task.Exception == null
             ? task.IsCanceled
                 ? FailFactory.GenericCanceledTask <TMapped>(task)
                 : task.Result
               .Bind(asyncMapper)
             : FailFactory.GenericExceptionTask <TMapped>(task.Exception))
 .Unwrap();