C# – Undocumented Keywords

While browsing the code of the interlocked class I stumbled upon the following piece of code

public static T CompareExchange<T>(ref T location1, T value, T comparand) where T : class
{
    // _CompareExchange() passes back the value read from location1 via local named 'value'
    _CompareExchange(__makeref(location1), __makeref(value), comparand);
    return value;
}

Further googling revealed that there are actually 4 undocumented keywords in C# __arglist, __refvalue, __makeref, __reftype

More on the subject can be found on codeproject: http://www.codeproject.com/Articles/38695/UnCommon-C-keywords-A-Look

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: