¡@

Home 

c# Programming Glossary: taskcompletionsource

Retry a task multiple times based on user input in case of an exception in task

http://stackoverflow.com/questions/10490307/retry-a-task-multiple-times-based-on-user-input-in-case-of-an-exception-in-task

static Task T Retry T Func T func int retryCount int delay TaskCompletionSource T tcs null if tcs null tcs new TaskCompletionSource T Task.Factory.StartNew.. delay TaskCompletionSource T tcs null if tcs null tcs new TaskCompletionSource T Task.Factory.StartNew func .ContinueWith _original if _original.IsFaulted.. samples and uses a timer to trigger a TaskCompletionSource when the timeout occurs. The F# version is a lot simpler let..

General purpose FromEvent method

http://stackoverflow.com/questions/12865848/general-purpose-fromevent-method

OnCompletion public static Task FromEvent MyClass obj TaskCompletionSource object tcs new TaskCompletionSource object obj.OnCompletion.. FromEvent MyClass obj TaskCompletionSource object tcs new TaskCompletionSource object obj.OnCompletion tcs.SetResult null return tcs.Task.. signature but ignoring all parameters that accesses a TaskCompletionSource that we already have and sets its result. Fortunately I found..

C# WebBrowser Control - Form Submit Not Working using InvokeMember(“Click”)

http://stackoverflow.com/questions/19044659/c-sharp-webbrowser-control-form-submit-not-working-using-invokememberclick

int timeout Timeout.Infinite var onloadTcs new TaskCompletionSource bool EventHandler onloadEventHandler null WebBrowserDocumentCompletedEventHandler..

Create a completed Task<T>

http://stackoverflow.com/questions/4245968/create-a-completed-taskt

override Task Result StartSomeTask var taskSource new TaskCompletionSource Result taskSource.SetResult theResult return taskSource.Task..

Correct way to delay the start of a Task

http://stackoverflow.com/questions/4990602/correct-way-to-delay-the-start-of-a-task

if dueTimeMs 0 return _sPreCompletedTask var tcs new TaskCompletionSource object var ctr new CancellationTokenRegistration var timer new.. private static Task GetPreCanceledTask var source new TaskCompletionSource object source.TrySetCanceled return source.Task private static.. private static Task GetCompletedTask var source new TaskCompletionSource object source.TrySetResult null return source.Task share improve..