Compiler Error CS0158
The label 'label' shadows another label by the same name in a contained scope
A label in an inner scope hides a label with the same name in an outer scope. For more information, see goto.
The following sample generates CS0158:
// CS0158.cs
namespace MyNamespace
{
public class MyClass
{
public static void Main()
{
goto lab1;
lab1:
{
lab1:
goto lab1; // CS0158
}
}
}
}
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: