共用方式為


編譯器錯誤 C3900

'member':目前的範圍中不允許

屬性區塊只能包含函式宣告和內嵌函式定義。 屬性區塊中不允許函式以外的成員。 不允許 typedefs、運算子或 friend 函式。 如需詳細資訊,請參閱 property

事件定義只能包含存取方法和函式。

下列範例會產生 C3900:

// C3900.cpp
// compile with: /clr
ref class X {
   property int P {
      void set(int);   // OK
      int i;   // C3900 variable declaration
   };
};

下列範例會產生 C3900:

// C3900b.cpp
// compile with: /clr
using namespace System;
delegate void H();
ref class X {
   event H^ E {
      int m;   // C3900

      // OK
      void Test() {}

      void add( H^ h ) {}
      void remove( H^ h ) {}
      void raise( ) {}
   }
};