EndPoint: Syntax in C # - what is it?

I am looking at the code in a project that has recently joined it, and in a forms application for C # for .NET 3.5 . I found this:

public void foo()
{
    //Normal code for function foo.

//This is at the end and it is left-indented just as I put it here.
EndPoint:
    {
    }
}

When I click "EndPoint / Go to Definition", it says "Cannot go to the endpoint", but the project as a whole is quite small and compiles / starts without errors, so this is not a missing link or something else.

What is EndPoint and what is this syntax with the name: {}?

+5
source share
2 answers

Its for goto. See: http://msdn.microsoft.com/en-us/library/13940fs2%28VS.71%29.aspx

colons , goto . #, . ( , "" )

goto: http://weblogs.asp.net/stevewellens/archive/2009/06/01/why-goto-still-exists-in-c.aspx

: , , , . . , " " goto Endpoint; , - . Endpoint:, goto Endpoint; , , ( ) .

+5

, EndPoint:. . , -

public Foo()
{
    {
        int bar = 10;
        Console.WriteLine(bar);
    }

    Console.WriteLine(bar); //Error: "Cannot resolve symbol bar."  It does not exist in this scope.

    {
        int bar = 20;  //Declare bar again because the first bar is out of scope.
        Console.Writeline(bar);
    }
}
+2

All Articles