Search code examples
c#labelgoto

Code Curiosity in C#


I was looking at the YUI Compressor and came across this piece of code in the ECMA.NET project (Continuation file if you are interested).

protected internal override int FindPrototypeId (string s)
    {
        int id;
        #region Generated PrototypeId Switch
    L0: {
            id = 0;
            string X = null;
            if (s.Length == 11) { X = "constructor"; id = Id_constructor; }
            if (X != null && X != s && !X.Equals (s))
                id = 0;
        }
    EL0:
        #endregion
        return id;
    }

I have no idea what L0: and EL0: are doing here and have never seen this before. The term seems too rudimentary for google as well.

Anyone know anything about this?


Solution

  • They look like lables for use as goto targets. See http://msdn.microsoft.com/en-us/library/13940fs2.aspx for more information.