C# switch pattern matching one default. #3897
Replies: 4 comments 3 replies
-
Consider using I feel like there might be a simpler way to do this, such as |
Beta Was this translation helpful? Give feedback.
-
To me it seems like a glaring hole in the switch statement if a "case" can have a "with" expression but a "default" cannot. |
Beta Was this translation helpful? Give feedback.
-
I moved this to csharplang, as this is a discussion about a proposed change to the language. |
Beta Was this translation helpful? Give feedback.
-
Has this discussion been narrowed down to the desired syntax? Supporting a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to see the pattern matching on a switch statement extended to the default case.
IE:
switch( SomeValue )
{
case Value1 when ( something == 0)
break;
case Value2 when ( something == 1)
break;
default when ( something == 1)
break;
default when ( something == 3)
break;
default:
break;
}
Beta Was this translation helpful? Give feedback.
All reactions