03-27-2015, 05:54 PM
They do now indeed because pragma pack is used. But before there was padding involved.
But even with the padding C# could still read it fine with Marshal.PtrToStructure
public static T ByteToType<T>(BinaryReader reader)
{
byte[] bytes = reader.ReadBytes(Marshal.SizeOf(typeof(T)));
GCHandle handle = GCHandle.Alloc(bytes, GCHandleType.Pinned);
T theStructure = (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T));
handle.Free();
return theStructure;
}

