Martin

Martin

  • NA
  • 2
  • 0

Struct declaration TypeLoadException

Mar 1 2006 7:54 AM
Hi,

What wrong with my struct declaration ?
When I run my program, I got a TypeLoadException.

[StructLayout(LayoutKind.Explicit, CharSet=CharSet.Ansi, Size=16)]
struct InfoRegister
{
   [FieldOffset(0)]
   public uint TargetIdBitField;

   [FieldOffset(4)]
   [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9) ]
   public byte[] Label;

   [FieldOffset(13)]
   public byte Mode;

   [FieldOffset(14)]
   public byte Index;

   [FieldOffset(15)]
   public byte CS;

   [FieldOffset(0)]
   [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16) ]
   public ushort[] StructInUShortArray;
}

Thanks