Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
LINQ Performance: Multiple Enumeration, Materializing and Measuring with BenchmarkDotNet
How many times the same query runs without you noticing, when ToList saves you and when it hurts, Any() instead of Count() > 0 and TryGetNonEnumeratedCount; measuring with BenchmarkDotNet 0.15.8 why a Where inside a loop is 50x slower than a lookup, and comparing loops with LINQ on a noisy machine, with real numbers.
LINQ with Real Data: Scenarios on Orders Read from a JSON File
LINQ over orders read from a file with System.Text.Json: the casing trap and JsonSerializerDefaults.Web, validating the data (duplicates, unknown customers, bad quantities), monthly revenue, best sellers, a customer report with GroupJoin, writing JSON back and streaming with DeserializeAsyncEnumerable.
LINQ and .NET 7–8: Order, ToDictionary Without Selectors and Performance
.NET 7's Order and OrderDescending, which need no key selector, why a missing IComparable only blows up at runtime, culture-sensitive versus ordinal string sorting, .NET 8's selector-less ToDictionary, and vectorized Max/Sum plus Order versus OrderBy(x => x) measured with BenchmarkDotNet.
LINQ and .NET 9: CountBy, AggregateBy and Index
LINQ in .NET 9: CountBy, which returns a sequence rather than a dictionary, AggregateBy for per-key accumulation and a BenchmarkDotNet measurement of their memory advantage over GroupBy, Index() instead of Select((x, i) => ...), the Queryable counterparts and the mutable seed trap.
LINQ and .NET 10: LeftJoin, RightJoin, Shuffle, Sequence and Async LINQ
LINQ in .NET 10: LeftJoin and RightJoin replacing the GroupJoin and DefaultIfEmpty pattern, the deferred Shuffle, Sequence and InfiniteSequence built on generic math, System.Linq.AsyncEnumerable in the BCL and the CS0121 clash with the System.Linq.Async package; a short look at FullJoin coming in .NET 11.