Skip to content
Discussion options

You must be logged in to vote

With disjunctive patterns in pattern matching in C# 9.0 you can do this:

if (x is 1 or 2 or 3) { ... }

Although you are limited to constants as the operands.

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@luckyexpert
Comment options

Answer selected by luckyexpert
Comment options

You must be logged in to vote
1 reply
@luckyexpert
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants