コード例 #1
0
        public RemoveResult <Q> Then <Q>
            (Func <P, Q> f)
        {
            if (f == null)
            {
                throw new ArgumentNullException(nameof(f));
            }


            return(Match(
                       success: value => RemoveResult <Q> .WasSuccess(f(value)),
                       notFound: () => RemoveResult <Q> .WasNotFound()
                       ));
        }
コード例 #2
0
        public async static Task <RemoveResult <Q> > ThenAsync <Q>
            (this RemoveResult <Q> task
            , Func <Q, Task> f)
        {
            if (task == null)
            {
                throw new ArgumentNullException(nameof(task));
            }
            if (f == null)
            {
                throw new ArgumentNullException(nameof(f));
            }


            return(await
                   task
                   .Match(
                       success : async value => { await f(value); return task; },
                       notFound : () => Task.FromResult(RemoveResult <Q> .WasNotFound())
                       ));
        }