unsafe C#: How can I create an int[] from a pointer to a preexisting memory location?
问题 I am using shared memory for inter-process communication in an unsafe class. Part of the memory is reserved to hold a fixed array of int. Basically, I have a method that sets up the shared memory. Something like this: private int* sizePtr; private ???* arrayPtr; void SetupMemory(byte *pointerToSharedMem) { this.sizePtr = (int*)pointerToSharedMem; pointerToSharedMem += sizeof(int); this.arrayPtr = (???*)pointerToSharedMem; pointerToSharedMem += sizeof(int) * FixedSizeOfArray; } How do I need