JetBrains Rider
 
2024.3
Get JetBrains Rider

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.