analyzer

Hunting the N+1 Query Problem with a Roslyn Analyzer Read in English

Most collection-related performance advice stops at the method boundary: avoid redundant ToArray() calls, pre-size your List<T>, swap a linear Contains() scan for a HashSet<T>. Those micro-optimizations matter, but they pale in comparison to a much bigger and much more common mistake — the N+1 Query Problem.

Read more...

Harmful collection transformations. Part 2: automatic diagnostics Read in English

The previous post contains code examples that can be simplified by removing ToArray() or ToCharArray() calls. And an interesting example with List<char> constructor. But we need to be very attentive to find such places in our code. It would be much safer to do it automatically. This post shows us about automatic compiler diagnostics that can detect issues.

Read more...