public static ResultSwapDelegate <int, TestDelegateAsync, TestDelegateResult <int> > GetResultSwapDelegate() { ResultSwapDelegate <int, TestDelegateAsync, TestDelegateResult <int> > resultSwapDelegate = (preCallback, yieldA, postCallback) => { TestDelegateAsync invoked = (a, b, c) => { var pre = preCallback.Invoke(); var preResult = pre.Invoke(a, b, c); var delegateTask = postCallback.Invoke(preResult); return(delegateTask); }; var yieldTask = yieldA.Invoke(invoked); return(yieldTask); }; return(resultSwapDelegate); }
public static Func <Func <TestDelegateAsync>, YieldCallbackAsync <TestDelegateAsync>, Func <Task, Task>, Task> GetSandwichDelegate() { Func <Func <TestDelegateAsync>, YieldCallbackAsync <TestDelegateAsync>, Func <Task, Task>, Task> sandwichDelegate = (preCallback, yieldA, postCallback) => { TestDelegateAsync invoked = (a, b, c) => { var pre = preCallback.Invoke(); var callbackTask = pre.Invoke(a, b, c); var delegateTask = postCallback.Invoke(callbackTask); return(delegateTask); }; var yieldTask = yieldA.Invoke(invoked); return(yieldTask); }; return(sandwichDelegate); }