共用方式為


編譯器錯誤 C3271

'member': 對 FieldOffset 屬性無效的值 'value'

已傳遞負值給 FieldOffset 屬性。

下列範例會產生 C3271:

// C3271.cpp
// compile with: /clr /c
using namespace System;
using namespace System::Runtime::InteropServices;

[StructLayout(LayoutKind::Explicit)]
value class MyStruct1 {
   public: [FieldOffset(0)] int a;
   public: [FieldOffset(-1)] long b;   // C3271
};