Top "Task-parallel-library" questions

The Task Parallel Library is part of the .NET Framework since .NET 4. It is a set of APIs to enable developers to program asynchronous applications.

When to dispose CancellationTokenSource?

The class CancellationTokenSource is disposable. A quick look in Reflector proves usage of KernelEvent, a (very likely) unmanaged resource. Since …

c# c#-4.0 task-parallel-library plinq parallel-extensions
What is the advantage of using async with MVC5?

What is the difference between: public ActionResult Login(LoginViewModel model, string returnUrl) { if (ModelState.IsValid) { IdentityResult result = IdentityManager.Authentication.CheckPasswordAndSignIn(…

asp.net-mvc task-parallel-library async-await asp.net-mvc-5 asp.net-identity
How to limit the amount of concurrent async I/O operations?

// let's say there is a list of 1000+ URLs string[] urls = { "http://google.com", "http://yahoo.com", ... }; // now let's send HTTP …

c# asynchronous task-parallel-library async-ctp async-await
What is a replacement method for Task.Run in .NET 4.0 using C#?

I got this program that gives me syntax error "System.Threading.Tasks.task does not contain a definition for Run." …

c# .net asynchronous task-parallel-library
Create a completed Task<T>

I'm implementing a method Task<Result> StartSomeTask() and happen to know the result already before the method is …

c# .net task-parallel-library
When to use BlockingCollection and when ConcurrentBag instead of List<T>?

The accepted answer to question "Why does this Parallel.ForEach code freeze the program up?" advises to substitute the List …

c# wpf multithreading linq task-parallel-library
How do I get a return value from Task.WaitAll() in a console app?

I am using a console app as a proof of concept and new need to get an async return value. …

c# .net task-parallel-library console-application async-await
Where to define callback for Task based asynchronous method

Following this question, I am trying to implement an async method using the TPL, and trying to follow TAP guidelines. …

c# asynchronous callback task-parallel-library
Parallel.ForEach and async-await

I had such method: public async Task<MyResult> GetResult() { MyResult result = new MyResult(); foreach(var method in Methods) { …

c# async-await task-parallel-library parallel.foreach