#597 – March 01, 2026
HybridCache combines fast in-memory caching with distributed caching like Redis
Solving the distributed cache invalidation problem with Redis and HybridCache
7 minutes by Milan Jovanović
Distributed systems scale well but make caching harder. In .NET 9, HybridCache combines fast in-memory caching with distributed caching like Redis. However, in multi-server setups, local caches are not automatically synchronized, which can cause stale data. Milan explains the problem and shows how to use Redis Pub/Sub as a backplane to achieve real-time cache invalidation and keep data consistent across all nodes.
Build Your Own AI Application Using Prebuilt Blazor Components
sponsored by Progress Telerik
Learn how to connect AI endpoints, manage prompt flows, stream model responses, and embed advanced UI patterns—all without writing heavy custom infrastructure.
Cleaner switch expressions with pattern matching in C#
1 minute by Bart Wullems
Pattern matching in C# lets you map multiple string values to the same result without chaining cases or using a dictionary. The `or` keyword combines patterns so one case handles several inputs at once. This also works with ranges and negations. The result is clean, readable code where each branch clearly shows its intent.
EF Core tricks for bulk reading large data sets
6 minutes by Aram
Entity Framework Extensions adds five bulk read methods that replace slow IN queries with server side joins using temporary tables. BulkRead and WhereBulkContains fetch matching rows, while the NotContains variants return unmatched rows for gap analysis. All methods support composite keys and unlimited list sizes, removing the core limits of standard LINQ Contains. The result is faster, more scalable data reads with fewer round trips.
Is it faster to index into an array or use switch statement for lookups?
3 minutes by Jiří Činčura
Jiří compares two ways to map numbers to strings: array indexing and a switch expression. Both run in well under one nanosecond for known values, making the difference negligible. The switch version was slightly faster in most cases, likely due to branch prediction. Use whichever style you prefer, as the performance gap is too small to matter.
Retrieve method source file location at runtime in .NET
4 minutes by Gérald Barré
Gérald shows how to get the source file path and line number of any .NET method at runtime using Portable PDB files. Caller attributes only work at compile time and require changing method signatures. By reading Portable PDB metadata, you can retrieve method location details without modifying code. Gérald argues that this is useful for tools like snapshot testing that need to update source files automatically.
And the most popular article from the last issue was: