Wouter de Kort

Exam Ref 70–483: Programming in C#

Notify me when the book’s added
To read this book, upload an EPUB or FB2 file to Bookmate. How do I upload a book?
  • Mike Petrov-Vodkinhas quoted8 years ago
    The SynchronizationContext abstracts the way these different applications work and makes sure that you end up on the right thread when you need to update something on the UI or process a web request
  • Mike Petrov-Vodkinhas quoted8 years ago
    public Task SleepAsyncA(int millisecondsTimeout)
    {
    return Task.Run(() => Thread.Sleep(millisecondsTimeout));
    }
    public Task SleepAsyncB(int millisecondsTimeout)
    {
    TaskCompletionSource<bool> tcs = null;
    var t = new Timer(delegate { tcs.TrySetResult(true); }, null, -1, -1);
    tcs = new TaskCompletionSource<bool>(t);
    t.Change(millisecondsTimeout, -1);
    return tcs.Task;
    }
  • Mike Petrov-Vodkinhas quoted8 years ago
    You should use the Parallel class only when your code doesn’t have to be executed sequentially
fb2epub
Drag & drop your files (not more than 5 at once)