dynamicexpresso / DynamicExpresso

C# expressions interpreter
http://dynamic-expresso.azurewebsites.net/
MIT License
1.99k stars 374 forks source link

Pattern matching expressions #202

Open ealeykin opened 2 years ago

ealeykin commented 2 years ago

It would great to support pattern matching, not sure how complex the implementation is, but for example having the following condition:

value == "match" || value == null

is much more readable with cs pattern matching

value is "match" or null
metoule commented 2 years ago

Relevant documentation : https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/patterns Relevant specifications : https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/expressions#121212-the-is-operator

We can probably focus on the is operator, and ignore the switch statement and expression.