.NET pointer comparison

PHOTO EMBED

Tue Jun 28 2022 14:28:07 GMT+0000 (Coordinated Universal Time)

Saved by @Marcos_ #cpp

// here normal pointer
P* ptr = new P; // usual pointer allocated on heap
P& nat = *ptr; // object on heap bind to native object

//.. here CLI managed 
MO^ mngd = gcnew MO; // allocate on CLI heap
MO% rr = *mngd; // object on CLI heap reference to gc-lvalue
content_copyCOPY

In general, the punctuator % is to ^ as the punctuator & is to *. In C++ the unary & operator is in C++/CLI the unary % operator. While &ptr yields a P*, %mngd yields at MO^.

https://stackoverflow.com/questions/202463/what-does-the-caret-mean-in-c-cli