View Single Post
  #2 (permalink)  
Old April 21st, 2005, 08:12 AM
Obnox Obnox is offline
Registered User
Join Date: Apr 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Obnox

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?