Code inspection: Extract common property pattern
This inspection reports a C# property pattern where several nested subpatterns repeat the same qualifier chain. This usually appears in patterns like A.B.X, A.B.Y, A.B.Z. C# lets you extract the shared A.B part once and place the remaining checks inside a nested property pattern, which is shorter and easier to read.
Example
if (value is { Address.City.Name: "Paris", Address.City.ZipCode: 75000 })
{
}
if (value is { Address.City: { Name: "Paris", ZipCode: 75000 } })
{
}
Quick-fix
Extract the repeated qualifier into a nested property pattern.
29 March 2026