From: tony on
I defined a structure like following, When the program run into one function
that declared a variable of that structure , I got "TypeLoadException".
Are there any invalid syntax in the definition?
I used WM6, Thanks!

[StructLayout(LayoutKind.Explicit)]
public struct BitMapFileHeader
{
//tagBITMAPFILEHEADER
[FieldOffset(0)]
[MarshalAs(UnmanagedType.U2)]
public UInt16 bfType;
[FieldOffset(2)]
[MarshalAs(UnmanagedType.U4)]
public UInt32 bfSize;
[FieldOffset(6)]
[MarshalAs(UnmanagedType.U2)]
public UInt16 bfReserved1;
[FieldOffset(8)]
[MarshalAs(UnmanagedType.U2)]
public UInt16 bfReserved2;
[FieldOffset(10)]
[MarshalAs(UnmanagedType.U4)]
public UInt32 bfOffBits;

//tagBITMAPINFOHEADER
[FieldOffset(14)]
[MarshalAs(UnmanagedType.U4)]
public UInt32 biSize;
[FieldOffset(18)]
[MarshalAs(UnmanagedType.I4)]
public Int32 biWidth;
[FieldOffset(22)]
[MarshalAs(UnmanagedType.I4)]
public Int32 biHeight;
[FieldOffset(26)]
[MarshalAs(UnmanagedType.U2)]
public UInt16 biPlanes;
[FieldOffset(28)]
[MarshalAs(UnmanagedType.U2)]
public UInt16 biBitCount;
[FieldOffset(30)]
[MarshalAs(UnmanagedType.U4)]
public UInt32 biCompression;
[FieldOffset(34)]
[MarshalAs(UnmanagedType.U4)]
public UInt32 biSizeImage;
[FieldOffset(38)]
[MarshalAs(UnmanagedType.I4)]
public Int32 biXPelsPerMeter;
[FieldOffset(42)]
[MarshalAs(UnmanagedType.I4)]
public Int32 biYPelsPerMeter;
[FieldOffset(46)]
[MarshalAs(UnmanagedType.U4)]
public UInt32 biClrUsed;
[FieldOffset(50)]
[MarshalAs(UnmanagedType.U4)]
public UInt32 biClrImportant;
}