You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrong information about pattern matching switch statement #1585
In [https://docs.microsoft.com/en-us/dotnet/articles/csharp/csharp-7#pattern-matching], the documentation states that:
The code above adds cases for 0 as a special case of int, and null as a special case when there is no input. This demonstrates one important new feature in switch pattern expressions: the order of the case expressions now matters. The 0 case must appear before the general int case. Otherwise, the first pattern to match would be the int case, even when the value is 0.
Switching the case 0 with case int val will be a CS8120 The switch case has already been handled by a previous case.
What works is adding the guard when val != 0 to case int val.
Activity
Update pattern matching to fix a couple small issues (#1612)
Update Live from Master (#1658)