Compiler Error C3270
'field': the FieldOffset attribute can only be used in the context of StructLayout(Explicit), in which case it is required
A field was marked with FieldOffset, which is only allowed when StructLayout(Explicit) is in effect.
The following sample generates C3270:
// C3270_2.cpp
// compile with: /clr /c
using namespace System::Runtime::InteropServices;
[ StructLayout(LayoutKind::Sequential) ]
// try the following line instead
// [ StructLayout(LayoutKind::Explicit) ]
public value struct MYUNION
{
[FieldOffset(0)] int a; // C3270
// ...
};