Browse by Topic
Popular
Popular Posts
Latest
Latest Posts
Implementing the C# Dispose Pattern
Learn how to implement the C# dispose pattern correctly, covering IDisposable, finalizers, using statements, async disposal, and common failure modes.
Using C# SemaphoreSlim to Limit Concurrent Access
Learn how C# SemaphoreSlim limits concurrent access to shared resources, with async waiting, cancellation, and practical throttling examples.
C# ConcurrentStack: Thread-Safe LIFO Collection
Learn how to use C# ConcurrentStack for thread-safe LIFO operations: Push, TryPop, TryPeek, bulk methods, and the performance tradeoffs to consider.
Using C# ConcurrentQueue for Thread-Safe FIFO Work
Understand how to use C# ConcurrentQueue<T> for thread-safe FIFO operations: core methods, enumeration, performance, and common pitfalls.
Using C# ConcurrentDictionary for Thread-Safe Collections
Learn how to use C# ConcurrentDictionary for thread-safe operations, including atomic methods, performance tradeoffs, and when to choose it over other approaches.
C# Concurrent Collections: Choosing the Right Thread-Safe Collection
Learn how to choose and use C# concurrent collections such as ConcurrentDictionary, ConcurrentQueue, ConcurrentStack, ConcurrentBag, and BlockingCollection, including code examples and common pitfalls.
Using ThreadLocal<T> in C# for Per-Thread State
Learn how C# ThreadLocal<T> provides isolated per-thread state, when to use it instead of ThreadStatic or AsyncLocal, and how it affects memory and disposal.
C# volatile: Semantics and Practical Use
Understand what C# volatile does, when to use it, and its limits. Practical examples show correct usage and common pitfalls.
C# Interlocked: Atomic Operations Without Locks
c# interlocked: Learn how C# Interlocked provides atomic operations for thread-safe counters and lock-free updates without explicit locking.
C# Monitor vs Lock: When to Use Each
The lock statement compiles to Monitor.Enter and Monitor.Exit. Learn when the higher-level syntax is enough and when you need Monitor's advanced features like timeouts and thread signaling.