G
Guest
I have the following question
The Marshal class contains a function to allocate a block of memory
1. Marshal.AllocHGlobal ( int cb
2. Marshal.AllocHGlobal ( IntPtr cb
The first version I can understand, because the integer indicates the size of the memory block that is required
But the second version I do not understand. If I want a memoryblock of 20 bytes could I use
IntPtr p = Marshal.AllocHGlobal ( new IntPtr ( 20 ) )
Another reason for asking is the function Marshal.ReAllocHGlobal. This function only accepts an 'IntPtr' as a parameter
Can anyone tell me how to use the IntPtr parameter version of the function
Thanks
Stefan.
The Marshal class contains a function to allocate a block of memory
1. Marshal.AllocHGlobal ( int cb
2. Marshal.AllocHGlobal ( IntPtr cb
The first version I can understand, because the integer indicates the size of the memory block that is required
But the second version I do not understand. If I want a memoryblock of 20 bytes could I use
IntPtr p = Marshal.AllocHGlobal ( new IntPtr ( 20 ) )
Another reason for asking is the function Marshal.ReAllocHGlobal. This function only accepts an 'IntPtr' as a parameter
Can anyone tell me how to use the IntPtr parameter version of the function
Thanks
Stefan.