What are property and positional patterns useful for?
Short answer
They deconstruct and test an object's shape in one expression, enabling clear rules over complex data without manual null checks and casts.
Advertisement
AModel answer
They deconstruct and test an object's shape in one expression, enabling clear rules over complex data without manual null checks and casts.
var label = point switch { (0,0) => "origin", ( >0, >0) => "Q1", _ => "other" };Real-world example
Routing a domain event by its type and fields in one expressive switch.