Skip to content
ADHDecode
  1. Home
  2. Articles
  3. Csharp

Csharp Articles

50 articles

Add Distributed Tracing to C# Apps with OpenTelemetry

OpenTelemetry is the standard for generating and collecting telemetry data, and it's becoming the go-to for adding distributed tracing to your C# applic.

2 min read

Configure C# Apps Cleanly with the Options Pattern

Configure C# Apps Cleanly with the Options Pattern — The Options pattern in .NET is often presented as a way to load configuration from appsettings.json,.

3 min read

Advanced C# Pattern Matching: Switch Expressions, Positional, and Guards

C# pattern matching isn't just about switch statements anymore; it's evolved into a powerful expression that can dramatically simplify complex condition.

3 min read

Optimize C# Performance with PGO and AOT Compilation

Profile-Guided Optimization PGO and Ahead-of-Time AOT compilation can dramatically boost C# application performance, but they fundamentally alter how yo.

3 min read

Add Retry, Circuit Breaker, and Timeout to C# Apps with Polly

Add Retry, Circuit Breaker, and Timeout to C# Apps with Polly — Polly is a .NET resilience and transient-fault-handling library that allows developers t...

4 min read

Implement Rate Limiting in ASP.NET Core Middleware

Implement Rate Limiting in ASP.NET Core Middleware — ASP.NET Core's built-in rate limiting middleware is actually a sophisticated policy engine that allo.

3 min read

Use C# Records for Immutable Value Objects and DTOs

C# records are a language feature that lets you declare types that are primarily about holding data, and the compiler generates a bunch of boilerplate c.

3 min read

Eliminate Heap Allocations in C# with ref struct and stackalloc

ref struct and stackalloc are your secret weapons for obliterating heap allocations in C#, leading to significantly faster and more memory-efficient cod.

2 min read

Replace Reflection with C# Source Generators for Zero-Cost Abstraction

C# Source Generators let you eliminate reflection-based metaprogramming by generating code at compile time, effectively giving you zero-cost abstraction.

5 min read

Secure C# ASP.NET Apps Against OWASP Top 10 Vulnerabilities

Secure C# ASP.NET Apps Against OWASP Top 10 Vulnerabilities — ASP.NET applications, by default, are not inherently secure against the OWASP Top 10. Let'...

2 min read

SemaphoreSlim vs Mutex vs lock in C#: Choose the Right Primitive

SemaphoreSlim and Mutex are fundamentally different in how they manage access, with lock being a syntactic sugar for a specific implementation of mutual.

2 min read

Scale C# SignalR to Multiple Servers with Redis Backplane

The most surprising thing about scaling SignalR across multiple servers isn't just that it works, it's how little of your existing SignalR code you actu.

3 min read

Write C# Source Generators That Generate Boilerplate at Compile Time

Source Generators let you write C# code that runs during compilation, inspecting your existing code and producing new C# code that gets compiled along w.

3 min read

Write Zero-Allocation C# Code with Span<T> and Memory<T>

Span<T> and Memory<T> let you work with contiguous memory without allocating new objects, but their real magic is in how they force you to think about m.

3 min read

Optimize C# String Handling with Interning and StringBuilder

C# string interning is a performance optimization that can significantly speed up string comparisons and reduce memory usage by ensuring that only one c.

3 min read

Unit Test C# Code with Moq and NSubstitute

Unit Test C# Code with Moq and NSubstitute — practical guide covering csharp setup, configuration, and troubleshooting with real-world examples.

3 min read

Use unsafe Code and Pointers in C# for Performance-Critical Paths

Use unsafe Code and Pointers in C# for Performance-Critical Paths — practical guide covering csharp setup, configuration, and troubleshooting with real-...

3 min read

ValueTask vs Task in C#: Reduce Allocations in Hot Paths

ValueTask vs Task in C#: Reduce Allocations in Hot Paths — practical guide covering csharp setup, configuration, and troubleshooting with real-world exa...

3 min read

Deploy C# Worker Services to Production with Docker and Kubernetes

Deploying C# Worker Services to production with Docker and Kubernetes isn't about just getting your app running; it's about building a resilient, scalab.

3 min read

Zero-Downtime Deployments for C# ASP.NET Apps

Zero-Downtime Deployments for C# ASP.NET Apps — Zero-downtime deployments for C# ASP.NET apps are surprisingly achievable by treating your applicati.

3 min read

How C# async/await Works: State Machine Internals Explained

The async/await keywords in C# don't magically make code run on a separate thread; they transform your method into a state machine.

3 min read

Profile and Benchmark C# Code with BenchmarkDotNet

Profile and Benchmark C# Code with BenchmarkDotNet — BenchmarkDotNet is the de facto standard for benchmarking .NET code, but its real power lies in its .

2 min read

Blazor WebAssembly vs Server: Choose the Right Hosting Model

Blazor WebAssembly and Blazor Server are two distinct hosting models for Blazor applications, and picking the right one is less about "better" and more .

3 min read

Use CancellationToken Correctly in C# Async Code

CancellationToken is the unsung hero of robust C# asynchronous programming, and most developers treat it like a simple flag that stops a task – it's act.

3 min read

Build Producer-Consumer Pipelines in C# with System.Threading.Channels

Build Producer-Consumer Pipelines in C# with System.Threading.Channels — The System.Threading.Channels API allows you to build asynchronous producer-con...

3 min read

Dapper vs EF Core: Choose the Right ORM for Your C# App

Dapper is a micro-ORM that maps query results to objects, while EF Core is a full-featured ORM that allows you to work with your database using LINQ and.

2 min read

How .NET Dependency Injection Works Internally

How .NET Dependency Injection Works Internally — Dependency injection is the secret sauce that makes your .NET applications flexible, but it's not ab.

3 min read

Containerize C# .NET Apps for Production with Docker

Containerize C# .NET Apps for Production with Docker — You can run C# .NET apps in production using Docker, but the real magic isn't just packaging; it'...

2 min read

Implement Domain-Driven Design Patterns in C#

Domain-Driven Design DDD isn't just about organizing your code; it's about building software that truly reflects the complex realities of the business i.

4 min read

Fix EF Core Performance Pitfalls That Slow Down C# Apps

Fix EF Core Performance Pitfalls That Slow Down C# Apps — EF Core intermittently throws System.Data.SqlClient.SqlException with error code 8629 and the ...

4 min read

Implement Event Sourcing in C# with an Event Store

Event sourcing means storing every change to your application's state as a sequence of immutable events, rather than just the current state.

4 min read

Build Dynamic Queries in C# with Expression Trees

Expression trees let you build C# code as data structures, which is surprisingly powerful for generating dynamic queries.

3 min read

Speed Up Read-Only Lookups in C# with FrozenDictionary

FrozenDictionary is a specialized dictionary type in C# that offers significant performance improvements for read-only scenarios.

2 min read

C# Generics Deep Dive: Constraints, Variance, and Type Safety

C# generics are a lot more powerful and subtle than just making a List<T> work for any T. Let's see some code, not just talk about it

5 min read

Build Production gRPC Services in C# with .NET

gRPC services can be surprisingly slow if you don't configure HTTP/2 correctly, even though it's the protocol they rely on.

2 min read

Run Background Jobs in C# with IHostedService and BackgroundService

Run Background Jobs in C# with IHostedService and BackgroundService — practical guide covering csharp setup, configuration, and troubleshooting with rea...

3 min read

How C# Hot Reload Works and Its Limitations in Production

C# Hot Reload doesn't actually replace your running code; it injects new IL instructions into the executing method, all while the original method's stac.

3 min read

Stream Data Asynchronously in C# with IAsyncEnumerable

IAsyncEnumerable is C#'s answer to streaming data asynchronously, and the most surprising thing about it is that it doesn't actually stream data itself;.

3 min read

Call Native Libraries from C# with P/Invoke

P/Invoke is how C# talks to native code, but it's not a simple function call; it's a full-blown inter-process communication mechanism with its own marsh.

4 min read

C# Senior Engineer Interview Questions and Answers

C# Senior Engineer Interview Questions and Answers — practical guide covering csharp setup, configuration, and troubleshooting with real-world examples.

14 min read

Add Kubernetes Health Checks to C# ASP.NET Apps

Add Kubernetes Health Checks to C# ASP.NET Apps — Kubernetes health checks in C# ASP.NET apps aren't just about knowing if your app is running, they'r.

3 min read

How C# LINQ Deferred Execution Works Under the Hood

LINQ's deferred execution means your query doesn't actually run until you iterate over the results, which can be a huge performance win or a baffling so.

3 min read

Structured Logging in C# with ILogger and Serilog

Structured logging in C# isn't about making your logs look pretty; it's about turning them into searchable, queryable data that machines can understand.

3 min read

Implement CQRS in C# with MediatR

CQRS isn't just about separating reads from writes; it's about acknowledging that different operations have fundamentally different needs in terms of pe.

3 min read

Find and Fix Memory Leaks in C# with Heap Dumps and dotnet-trace

A C# memory leak happens when your application keeps holding onto objects it no longer needs, preventing the garbage collector from reclaiming that memo.

5 min read

C# Memory Management: CLR, GC, and What Causes OOM

C# Memory Management: CLR, GC, and What Causes OOM — practical guide covering csharp setup, configuration, and troubleshooting with real-world examples.

4 min read

How the ASP.NET Core Middleware Pipeline Processes Requests

How the ASP.NET Core Middleware Pipeline Processes Requests — The ASP.NET Core middleware pipeline doesn't just process requests; it is the request proc...

3 min read

Minimal APIs vs Controllers in .NET: Choose the Right Approach

Minimal APIs are often seen as just a simpler way to write controllers, but they're actually a fundamentally different architectural choice that can lea.

3 min read

Compile C# .NET 8 Apps to Native with AOT for Faster Startup

Compile C# .NET 8 Apps to Native with AOT for Faster Startup — C#/.NET 8 apps can launch almost instantly, even before your coffee is brewed, by compili...

3 min read

Migrate a C# Codebase to Nullable Reference Types

Migrate a C# Codebase to Nullable Reference Types — practical guide covering csharp setup, configuration, and troubleshooting with real-world examples.

3 min read
ADHDecode

Complex topics, finally made simple

Courses

  • Networking
  • Databases
  • Linux
  • Distributed Systems
  • Containers & Kubernetes
  • System Design
  • All Courses →

Resources

  • Cheatsheets
  • Debugging
  • Articles
  • About
  • Privacy
  • Sitemap

Connect

  • Twitter (opens in new tab)
  • GitHub (opens in new tab)

Built for curious minds. Free forever.

© 2026 ADHDecode. All content is free.

  • Home
  • Learn
  • Courses
Esc
Start typing to search all courses...
See all results →
↑↓ navigate Enter open Esc close