Compiler Error CS0152
The label 'label' already occurs in this switch statement
A label was repeated in a switch
statement.
The following sample generates CS0152:
// CS0152.cs
namespace MyNamespace
{
public class MyClass
{
public static void Main()
{
int i = 0;
switch (i)
{
case 1:
i++;
return;
case 1: // CS0152, two case 1 statements
i++;
return;
}
}
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: