I've been programming in C++
for years and then moved to .NET
. Everything much easier to understand so far, but I still struggle with synchronization things (in theory).
I remember seeing here on Stackoverflow that running a Task
won't actually create a new thread! That got me really confused.
How does asynchronous tasks run in .NET
?
Can you explain why
var value = await Task<int>.Run(() => { return 10; } );
doesn't spawn a new thread? And what it does instead?
Also, what exactly does Dispatcher.BeginInvoke
on WPF
?