I have this structure:
[StructLayout(LayoutKind.Sequential, Pack = 8)]
unsafe struct MyStruct_t
{
public UInt32 ulID;
public fixed Byte xValue[32];
}
and then I ran this command to get the size:
Console.WriteLine("Marshal.SizeOf(typeof(MyStruct_t))= {0}", Marshal.SizeOf(typeof(MyStruct_t)));
and the answer is consistent
Marshal.SizeOf(typeof(MyStruct_t))= 36
I was expecting 40. Am I missing something? Is there something I donβt understand in the meaning of Pack = 8?
source
share