Servy

8

votes
3

answer
2.1k

views

General purpose FromEvent method

Using the new async/await model it's fairly straightforward to generate a Task that is completed when an event fires; you just need to follow this pattern: public class MyClass { public event Action OnCompletion; } public static Task FromEvent(MyClass obj) { TaskCompletionSource tcs = new TaskComple...
Servy