简体   繁体   中英

What does construction ^(int&) mean in c#?

I found this construction with decompiler tool. Looks like it is something connected with multithreading. what does mean ^(int&) in c#?

upd

It used like variable declaration

^(int&) @someLock

This is invalid code, unsafe or not.


Assumption: The person writing the decompiler comes from a C/C++ background and did not know how to construct legal C# code (if at all possible) for a construct found in IL.

If we're following the breadcrumbs of the "operators" involved, this could mean this:

@someLock is a variable that will hold the value at some place in memory ( & means it is actually an address, and ^ means we're dereferencing the address).

Basically, it could be "the value at some specific point in memory", crammed into a single variable declaration. Think of it as a variable that is placed specifically at some address. From knowledge (and I may absolutely be wrong here), IL can handle this, but C# cannot.

This is unsafe code. It returns pointer to memory address

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM