Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for the exact list of possible MethodAttributes.SpecialName

I am aware of ctor, cctor, property/indexer prefix: get_, set_, event management prefix: add_, remove_. I have seen a raise_ prefix once or twice (do not remember where).

Does a definitive list exists at the .Net level (ECMA spec.)? If yes where is it?

Is it an "open list" so that any (new) language can define them for its (future) needs?

like image 825
Spi Avatar asked Oct 26 '22 06:10

Spi


1 Answers

User defined operators would be another example. Like System.String.op_Equality (operator==):

.method public hidebysig specialname static bool op_Equality(string a, string b) cil managed
{
    .maxstack 8
    L_0000: ldarg.0 
    L_0001: ldarg.1 
    L_0002: call bool System.String::Equals(string, string)
    L_0007: ret 
}

There's no exhaustive list, language implementations are free to use the attribute to hide their glue. You probably saw the raise_ prefix on code generated by the VB.NET compiler using the RaiseEvent accessor for example.

like image 99
Hans Passant Avatar answered Nov 02 '22 11:11

Hans Passant