🚀
Q1. What is SynchronizationContext?
A. Controls where continuations run (e.g., UI thread). ConfigureAwait(false) can avoid capturing context.
Advanced
🚀
Q2. How to avoid deadlocks with async?
A. Avoid blocking on Tasks (.Result/.Wait), use async all the way, and configure context appropriately.
Advanced
🚀
Q3. What is GC and generations?
A. Managed memory is collected by GC; generations (0/1/2) optimize for short-lived objects.
Advanced
🚀
Q4. What is Span<T>?
A. A stack-only type for slicing memory safely without allocations.
Advanced
🚀
Q5. What is variance (covariance/contravariance)?
A. Generic variance rules (out/in) enabling safe subtype assignment.
Advanced
🚀
Q6. What is thread-safety?
A. Correct behavior under concurrency; avoid races using locks, immutability, and concurrent collections.
Advanced
🚀
Q7. What is a memory leak in .NET?
A. Holding references prevents GC (event handlers, static caches). Unmanaged resources also need disposal.
Advanced
🚀
Q8. What is a cancellation token?
A. Cooperative cancellation for async operations and long-running tasks.
Advanced