M
Morten Wennevik
Hi,
Using a struct like the following, Marshal.SizeOf always reports 14 bytes yet the struct should be 13 bytes.
What am I doing wrong?
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct GIF_HEADER
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst=3)]
public byte[] Signature; // Header Signature (always "GIF")
[MarshalAs(UnmanagedType.ByValArray, SizeConst=3)]
public byte[] Version; // GIF format version ("87a" or "89a")
public UInt16 ScreenWidth; // width in pixels
public UInt16 ScreenHeight; // height in pixels
public byte Packed; // screen and color map information
public byte BackgroundColor; // background color index
public byte AspectRatio; // pixel aspect ratio
}
Morten
Using a struct like the following, Marshal.SizeOf always reports 14 bytes yet the struct should be 13 bytes.
What am I doing wrong?
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct GIF_HEADER
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst=3)]
public byte[] Signature; // Header Signature (always "GIF")
[MarshalAs(UnmanagedType.ByValArray, SizeConst=3)]
public byte[] Version; // GIF format version ("87a" or "89a")
public UInt16 ScreenWidth; // width in pixels
public UInt16 ScreenHeight; // height in pixels
public byte Packed; // screen and color map information
public byte BackgroundColor; // background color index
public byte AspectRatio; // pixel aspect ratio
}
Morten