Example #1
0
        public static async Task <bool> DispatchActionAsync <TTarget, TIn>(this TTarget target, TIn input)
        {
            var task = FuncDispatcher <TTarget, TIn, Task> .Dispatch(target, input);

            if (task == null)
            {
                return(false);
            }

            await task;

            return(true);
        }
Example #2
0
        public static Task <TOut> DispatchFuncAsync <TTarget, TIn, TOut>(this TTarget target, TIn input, TOut fallback)
        {
            var result = FuncDispatcher <TTarget, TIn, Task <TOut> > .Dispatch(target, input);

            return(result ?? Task.FromResult(fallback));
        }
Example #3
0
        public static TOut DispatchFunc <TTarget, TIn, TOut>(this TTarget target, TIn input, TOut fallback)
        {
            var result = FuncDispatcher <TTarget, TIn, TOut> .Dispatch(target, input);

            return(Equals(result, default(TOut)) ? fallback : result);
        }