I have a situation where I have Intptr, and I have my own structure, which consists of 4 bytes. I want to read 4 bytes from Intptr into this structure of mine. But I want to fill 4 bytes in the structure separately. sort of
mystruct obj = new mystruct ().
obj.byte2 = "read the byte from Myintptr"
obj.byte1 = "read the next byte from MyIntptr"
Is it possible?
one way could be that I read it all into a byte array, first using Marshal.copy (), and then I will do the second step of copying to obj. But they are curious that there is another way.
source
share