Skip to content

Commit 27eae5d

Browse files
Add an example of several cases with single implementation
1 parent cf53e11 commit 27eae5d

File tree

1 file changed

+23
-0
lines changed
  • docs/csharp/language-reference/compiler-messages

1 file changed

+23
-0
lines changed

docs/csharp/language-reference/compiler-messages/cs0163.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,26 @@ public class MyClass
5656
}
5757
}
5858
```
59+
60+
Note that it is correct to have several `case`s for one implementation, like in the following snippet:
61+
62+
```csharp
63+
public class MyClass
64+
{
65+
public static void Main()
66+
{
67+
int i = 0;
68+
69+
switch(i)
70+
{
71+
case 1:
72+
case 2: // No CS0163
73+
i++
74+
break;
75+
76+
default:
77+
break;
78+
}
79+
}
80+
}
81+
```

0 commit comments

Comments
 (0)