You cannot use custom types with fixed arrays. (For more information, see TTon Response.)
Instead of trying to build a structure in C # with a specific memory layout, I think you should use the MarshalAs attribute to indicate how members should be ordered. Even if you manage to get members that take up the right amount of memory, you still have padding between the elements that cause alignment problems.
You can have a reference to a regular array in the structure and indicate that it should be mapped as ByValArray .
Guffa
source share