Skip to content
Discussion options

You must be logged in to vote

Wrapping an expression in parenthesis doesn't change it's type or value. That's always been true in C#. That does create an ambiguity with recursive positional patterns, which were added after constant patterns, and that's why you must explicitly disambiguate. You can also include the type pattern:

if (p is P(42)) Console.WriteLine(); // OK

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kyoyama-kazusa
Comment options

Answer selected by 333fred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants