domenic / proposal-blocks

Former home of a proposal for a new syntactic construct for serializable blocks of JavaScript code
215 stars 5 forks source link

Use Task.Run in C# code example #7

Closed Daniel15 closed 6 years ago

Daniel15 commented 6 years ago

For this basic use case, it's usually preferred to use Task.Run rather than Task.Factory.StartNew

Ref: https://blogs.msdn.microsoft.com/pfxteam/2011/10/24/task-run-vs-task-factory-startnew/ https://docs.microsoft.com/en-us/dotnet/standard/parallel-programming/task-based-asynchronous-programming

domenic commented 6 years ago

I swear I pulled this from some legit-looking MSDN API doc. But I guess I didn't search hard enough. Thank you!

Daniel15 commented 6 years ago

It could have been an old doc, Task.Run was only added in .NET Framework 4.5 😄