I solved the problem myself however not completely satisfied. Here's wy: I've changed the code to:
public unsafe class PointerArray
private int size;
public long* pArray;
public PointerArray(int size)
this.size = size;
Now, I use the pArray as a field, rather than a property. Obviously I have to make it public, which is the exact fact that i do not like this solution. However it does work, the only thing I need to do after instantiating the class is assign a pointer reference to the property like this:
int size = 10
long* pArray = stackalloc long [size];
PointerArray pa = new PointerArray(size);
pa.pArray = pArray;
Note also that I do not assign the address anymore but simply assign the reference.
I'm a bit mixed up on this topick. Can anyone help with a proper solution?