Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the symbol <> mean in MSIL?

Tags:

c#

.net

cil

I have this code after decompile

    SampleClass sampleClass;
    SampleClass <>g__initLocal0;
    int y;
    sampleClass = null;
Label_0018:
    try
    {
        <>g__initLocal0 = new SampleClass();
        <>g__initLocal0.X = 5;
        <>g__initLocal0.Y = 10;
        sampleClass = <>g__initLocal0;
        goto Label_003A;
    }
    catch (Exception)
    {
    Label_0035:
        goto Label_003A;
    }
Label_003A:
    y = sampleClass.Y;

I don't know what mean operator/symbol <> before some operations. Does somebody know?

like image 745
Jacek Avatar asked Apr 09 '13 07:04

Jacek


People also ask

What does this symbol mean on email?

On the Internet, @ (pronounced "at" or "at sign" or "address sign") is the symbol in an E-mail address that separates the name of the user from the user's Internet address, as in this hypothetical e-mail address example: [email protected].

What is this called @?

The @ symbol is correctly referred to as an asperand.

Where do we use the symbol @?

The at sign is most commonly found in email addresses and on social media, where it is used to tag specific users in posts. The symbol, @, can also stand in for the word at in everyday writing and in online conversation, where it is often used as a verb.


1 Answers

It's a compiler generated name - the <> characters are legal for identifiers in IL, but not in C#. So, the compiler knows it can generate names containing such characters without any chance that the name will conflict with a name you've used in your code.

In this particular case, <>g__initLocal0 is a new variable that has been introduced to hold a newly constructed instance of a class which is being initialized using initializer syntax. The original code was:

sampleClass = new SampleClass() { X = 5, Y = 10};

It's introduced to avoid sampleClass being observed with the partially constructed instance - after new SampleClass() has executed but before the assignments to X and Y occur. I.e. if Y = 10 throws an exception, it ensures that sampleClass remains null and not a new SampleClass with X set to 5 and some unknown value for Y.

like image 172
Damien_The_Unbeliever Avatar answered Oct 02 '22 17:10

Damien_The_Unbeliever