Asynchronous Programming in C#

9.–10.11.2026 | remote: Etäkoulutus, Etäkoulutus

Ohjelma

Maanantaina 9.11.

09:00

Introduction, Processes and Threads

  • Synchronous vs. asynchronous programming 
  • Processes and threads 
  • The cost of creating threads 
  • Thread Pool: worker and I/O threads 
  • When not to use the Thread Pool 
10:30

Break

10:45

Tasks and Waiting for Tasks

  • Creating tasks 
  • Returning data from a task 
  • Tasks vs. threads: choosing the right approach 
  • WaitAll vs. WaitAny 
  • WhenAll vs. WhenAny 
12:00

Lunch Break

13:00

Error Handling and Task Cancellation

  • Exceptions in threads and tasks 
  • CancellationTokenSource 
  • IsCancellationRequested and ThrowIfCancellationRequested 
  • Cancellation tokens 
  • Combining cancellation tokens 
14:15

Coffee Break

14:30

Continuations and Introduction to Async/Await

  • ContinueWith 
  • TaskContinuationOptions 
  • Async methods 
  • The async state machine 
  • The await keyword 
15:30

Summary and Key Takeaways

  • Review of the day’s key concepts 
  • Questions and discussion 
16:00

See you tomorrow! The first training day ends

Tiistaina 10.11.

09:00

Async/Await in Depth

  • Returning data from async methods 
  • Async all the way 
  • Async lambdas 
  • Optimizing async/await 
  • GetAwaiter().GetResult() 
  • WaitAsync 
10:30

Break

10:45

Task Schedulers and Async Error Handling

  • ThreadPoolTaskScheduler 
  • Default vs. Current task scheduler 
  • Creating custom task schedulers 
  • ExclusiveScheduler vs. ConcurrentScheduler 
  • Exceptions in async methods 
  • Task schedulers and UnobservedTaskException 
12:00

Lunch Break

13:00

Synchronization Contexts

  • SynchronizationContext vs. TaskScheduler 
  • ThreadPoolTaskScheduler 
  • DispatcherSynchronizationContext 
  • WindowsFormsSynchronizationContext 
  • Understanding context switching in asynchronous applications 
14:15

Coffee Break

14:30

ConfigureAwait and ValueTasks

  • Capturing the synchronization context 
  • Avoiding deadlocks 
  • ConfigureAwait and ConfigureAwaitOptions 
  • Tasks vs. ValueTasks 
  • Optimizing async methods 
  • Reducing allocations 
15:30

Course Summary and Key Takeaways

  • Review of asynchronous programming concepts 
  • Choosing the right asynchronous programming techniques 
  • Performance, reliability and common pitfalls 
  • Questions and discussion 
16:00

Thank you! The training ends