Freigeben über


Compilerfehler C3137

'property' : Eine Eigenschaft kann nicht initialisiert werden.

Bemerkungen

Eine Eigenschaft kann nicht initialisiert werden, z. B. in der Initialisierungsliste eines Konstruktors.

Example

Im folgenden Beispiel wird C3137 generiert:

// C3137.cpp
// compile with: /clr /c
ref class CMyClass {
public:
   property int Size {
      int get() {
         return 0;
      }
      void set( int i ) {}
   }

   CMyClass() : Size( 1 ) {   // C3137
      // to resolve this C3137, remove the initializer from the
      // ctor declaration and perform the assignment as follows
      // Size = 1;
   }
};