I\'m having a bit of a problem using FieldOffset correctly with arrays. The code below is an example where it doesn\'t work correctly for me:
[StructLayout(L
Your FieldOffset defines where each of your data elements are inside the struct..
By setting them all to 0, you're telling the compiler that they all at position 0.
The second thing I see is you're creating an array of bytes, shorts, and ints.
see: MSDN StructLayoutAttribute
[StructLayout(LayoutKind.Explicit)]
public struct IndexStruct {
[FieldOffset(0)]
public byte[16] data;
[FieldOffset(16)]
public short idx16;
[FieldOffset(18)]
public int idx32;
}