More about synchronization
About async/await
Difference between running a Func<Task> and Task.Run(). See this article.
Action vs Func<Task>.
- Running a
Func<Task>runs the first part of its body synchronously up until the firstawaitstatement. The rest part are run on a separate task. Task.Run()puts its input to a separate task to run.
The below two snippets are trivially different. TODO need elaborating.
1 | var tasks = Enumerable.Range(0, 100).Select(async x => |
compared to:
1 | var tasks = Enumerable.Range(0, 100).Select(x => Task.Run(async () => |
About SynchronizationContext
It's an abstraction interface whose implementations are used to dispatch asynchronous tasks in some specific ways. See this article.