ReSharper
 
Get ReSharper
Get your hands on the new features ahead of the release by joining the Early Access Program for ReSharper 2025.1! Learn more

Code inspection: Merge null/pattern checks into complex pattern

Last modified: 08 May 2024

This inspection suggests using list pattern syntax introduced in C# 11.

Before the introduction of this syntax, it was generally necessary to check the length of the collection and then use indexer access expressions to check the items in the collection. This inspection identifies such checks in your code and suggests replacing them with more concise list pattern matching.