Skip to content

Conversation

@BillWagner
Copy link
Member

@BillWagner BillWagner commented Nov 14, 2024

Fixes #43177

We've had feedback that indicates confusion on how C# parses patterns with multiple and, not, and or patterns. Add more examples that demonstrates the problems. Explain the binding order, and recommend using parentheses when the pattern can be misinterpreted.

Also, do a grammar check.


Internal previews

📄 File 🔗 Preview link
docs/csharp/language-reference/operators/patterns.md Pattern matching - the is and switch expressions, and operators and, or, and not in patterns

Fixes dotnet#43177

We've had feedback that indicates confusion on how C# parses patterns with multiple `and`, `not`, and `or` patterns. Add more examples that demonstrates the problems. Explain the binding order, and recommend using parentheses when the pattern can be misinterpreted.

Also, do a grammar check.
@BillWagner BillWagner requested a review from a team as a code owner November 14, 2024 17:16
@dotnetrepoman dotnetrepoman bot added this to the November 2024 milestone Nov 14, 2024
@BillWagner BillWagner requested a review from tdykstra November 14, 2024 17:16
@dotnet-policy-service dotnet-policy-service bot added the okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. label Nov 14, 2024
@BillWagner BillWagner enabled auto-merge (squash) November 15, 2024 20:15
@BillWagner BillWagner merged commit e49964b into dotnet:main Nov 15, 2024
8 checks passed
@BillWagner BillWagner deleted the pattern-binding-order branch November 15, 2024 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dotnet-csharp/svc lang-reference/subsvc okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

This article should include a discussion of binding order and logical patterns

2 participants