Using The Factory Design Pattern in .NET
Learn how to implement the Factory and Abstract Factory design patterns in C#/.NET with real-world examples for flexible object creation.
// thoughts
Deep dives into C#, ASP.NET Core, and the .NET ecosystem
Learn how to implement the Factory and Abstract Factory design patterns in C#/.NET with real-world examples for flexible object creation.
Learn how to implement the Decorator design pattern in C#/.NET to add behaviours dynamically, with examples using both manual and DI approaches.
Implement the Singleton design pattern in C#/.NET using Lazy<T> for thread safety, plus modern approaches with dependency injection containers.
Learn how to implement the Builder design pattern in C#/.NET to construct complex objects step by step with clean, maintainable code.
Updated .NET serialisation benchmarks for February 2023 comparing System.Text.Json, MessagePack, MemoryPack, Protobuf, and more frameworks.
Learn how to version ASP.NET Core MVC APIs using headers, querystrings, and URL-based approaches with the Asp.Versioning.Mvc package.
Set up XUnit integration tests with Docker containers using TestContainers and LocalStack, with reusable patterns for any Docker image.
Learn how to use retries with decorrelated jitter, bulkhead and circuit breaker patterns to increase reliability in your applications with Polly
Discover lesser-known C# features including duck typing with foreach and await, custom awaitable types, and using params with indexers.
Some services like AWS CloudWatch Metrics only allow scaling based off a single value. Luckily, we can blend metrics together to create new ones, which we can then use in our scaling policies
Learn how to mock methods with ref, in, and out parameters using Moq in C# with practical examples and minimal test code changes.
Build a simple runtime feature toggle system in ASP.NET Core using IConfiguration and the options pattern, with a path to dynamic toggles.
A deep dive into the .NET EventCounters API covering custom metrics, diagnostic counter types, Docker diagnostics tooling, and listening to inbound and outbound HTTP requests.
Build custom ASP.NET Core input and output media formatters using Utf8Json for high-performance JSON serialisation in your APIs.
A practical guide to IIS URL Rewrite covering canonical hostnames, HTTPS redirects, httpOnly cookies, SameSite cookies, secure cookies, and trailing slash removal.
Discover the subtle integer overflow bug present in most binary search implementations and learn how to fix it with a simple one-line change.
Discover the often overlooked unit tests for Equals overrides in C# including reflexive, symmetric, transitive, and consistency checks.
Learn how to enable HTTP Strict Transport Security (HSTS) in ASP.NET MVC using a custom ActionFilter to protect against network attacks.
Learn the correct way to implement IDisposable in C# including managed and unmanaged resource cleanup, finalizers, and the full dispose pattern.
Micro-benchmark comparing Semaphore and SemaphoreSlim performance in C# showing the significant speed advantage of the lightweight SemaphoreSlim class.