Code inspection: Merge nested property patternsLast modified: 08 November 2024Category: Language Usage OpportunitiesID: MergeNestedPropertyPatternsEditorConfig: resharper_merge_nested_property_patterns_highlighting=[error|warning|suggestion|hint|none]Default severity: SuggestionLanguage: C#Requires SWA: NotipYou can suppress this inspection to ignore specific issues, change its severity level to make the issues less or more noticeable, or disable it altogether.C# 10 simplifies the pattern-matching syntax with dotted access instead of object pattern nesting. JetBrains Rider detects such places in your code and suggests the corresponding quick-fix ( AltEnter):Suboptimal codepublic class UserTest{ public UserTest() { var user = new User(); // Merge nested property patterns if (user is { Tags: { Count: 0 } }) Console.WriteLine("do something"); }}After the quick-fixpublic class UserTest{ public UserTest() { var user = new User(); if (user is { Tags.Count: 0}) Console.WriteLine("do something"); }}public class User { public List<string> Tags { get; } = new(); }tipReverse transformation is available with a context action AltEnter.