When you create an object using a new statement in C # (or the corresponding statement in any other CLR language), the .NET runtime allocates memory in a โmanaged heapโ (just a .NET-managed runtime heap + garbage collector). This is, in fact, one of two heaps - one is for objects smaller than 85 KB, and the other is for objects larger than this (large arrays, etc.). In any case, when such an object is selected, you do not return a real pointer describing the address of the allocated space, as in native code. What you get is a "handle", which is an indirect reference to this memory address. This direction exists because the actual memory location may change when the GC collects and compacts the heap.
If you want to talk to unmanaged / native code that a pointer expects, you need to use pointers rather than descriptors .. NET provides two methods for converting a .NET descriptor to a raw pointer that can be passed into unmanaged code.
Hope this helps!
Ani
source share