Compiler Error C3812

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C3812.

property' must be the first token in a property declaration

When declaring a property, the __property keyword must be the first token on the line.

C3812 is only reachable using /clr:oldSyntax.

The following sample generates C3812:

// C3812.cpp  
// compile with: /clr:oldSyntax /c  
#using <mscorlib.dll>  
  
__gc class X {  
   static __property int get_Size() { // C3812, remove static specifier  
      return 0;  
   }  
};  

Show: