Duplicate:
I was trawling through some .NET Source Code using reflector when I came across something which I see very little of on the web, which is the label syntax.
From here I can see that it raises the chance of ugly spaghetti code:
goto 1:
goto 2:
if(booleanProperty) goto 1:
Is the purpose of the label simply so you can jump back and fourth inside a function?
What model usages of the C# label would you say there is? Do you have any experience with its implementation yourself? Was it a good experience or not?
if (1 == 1)
goto Stage2;
Stage1:
Console.WriteLine("Stage1");
Stage2:
Console.WriteLine("Stage2");