Click here to Skip to main content
15,894,460 members

Comments by Graeme_Grant (Top 200 by date)

Graeme_Grant 30-Apr-24 17:09pm View    
Deleted
Graeme_Grant 30-Apr-24 16:21pm View    
"Well, when I was at Microsoft we weren't using TAP yet... They embrace and abandon coding patterns as they need to ..."

F# added asynchronous workflows with await points in version 2.0 in 2007 (5 years before C#). Microsoft first released a version of C# with async/await in the Async CTP (2011) in .Net Framework. It was later officially released in C# 5 (2012).

Not just a fad or latest trend...
Graeme_Grant 30-Apr-24 15:09pm View    
I've done a lot of both, so I do talk from experience. You can write multi-threaded code like procedural code using TAP, Threads you can't. Your example above is a simple one, no different to Task.Run.

Look at the .Net Core source code. Look at the Microsoft documentation. They write all of the framework using TAP. Their docs also use TAP. When you create an app using the Microsoft templates, they use TAP. Show me the extensive use of Threads in the docs other than the Thread documentation itself. Show me a template from Microsoft that uses Threads. There is a reason that you can't.
Graeme_Grant 30-Apr-24 9:18am View    
Threads are not simple beyond the example given. TAP removes most of the complexity. You can still get TAP wrong if you do not understand it.
Graeme_Grant 30-Apr-24 8:02am View    
TAP[^] is the more modern way of doing the same thing.