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); }
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)); }
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); }