Created
February 4, 2012 01:41
-
-
Save DamianEdwards/1734345 to your computer and use it in GitHub Desktop.
Crazy TPL helper from SignalR for the day
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Task Interleave<T>(Func<T, Action, Task> before, Func<Task> after, T arg) | |
{ | |
var tcs = new TaskCompletionSource<object>(); | |
var tasks = new[] { | |
tcs.Task, | |
before(arg, () => after().ContinueWith(tcs)) | |
}; | |
return tasks.Return(); | |
} |
he he, come by my office and I'll explain it :)
On Mon, Feb 6, 2012 at 11:09 PM, Paul Batum < ***@***.*** > wrote:
What the hell does this do? I don't even know what Task[].Return() does.
But let me guess - its YESTERDAY's crazy TPL helper for SignalR. Right? :)
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/1734345
##
Cheers,
Damian
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What the hell does this do? I don't even know what Task[].Return() does. But let me guess - its YESTERDAY's crazy TPL helper for SignalR. Right? :)