Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
Performance in C#: Allocations, Structs and Measuring with BenchmarkDotNet
Why Stopwatch isn't enough, setting up BenchmarkDotNet 0.15.8 and reading its table, the measured difference between classes and structs, hidden allocations from boxing and closures, and benchmark pitfalls.
Attributes and Reflection in C#: Writing and Reading Your Own Attributes
An attribute living in metadata and created when read, Obsolete and CS0618, AttributeUsage, positional and named arguments, decimal not being a valid attribute parameter and CS0181, a small validator with reflection, discovering IDiscountRule types and running them with Activator and Invoke, a BenchmarkDotNet comparison of GetValue, a cached PropertyInfo and a typed delegate, and the limits of trimming and source generators.
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.