Class Cs.PropertyPatternClause

java.lang.Object
org.openrewrite.csharp.tree.Cs.PropertyPatternClause
All Implemented Interfaces:
Cs, org.openrewrite.java.tree.J, org.openrewrite.Tree
Enclosing interface:
Cs

public static final class Cs.PropertyPatternClause extends Object implements Cs
Represents a property pattern clause in C# pattern matching, which matches against object properties.

For example:

     // Simple property pattern
     if (obj is { Name: "test" })

     // Multiple properties
     if (person is { Name: "John", Age: > 18 })

     // Nested property patterns
     if (order is { Customer: { Name: "test" } })

     // With variable declarations
     if (person is { Id: int id, Name: string name })

     // In switch expressions
     return shape switch {
         { Type: "circle", Radius: var r } => Math.PI * r * r,
         { Type: "square", Side: var s } => s * s,
         _ => 0
     };