We recommend using Visual Studio 2017

Compiler Error C2779


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 C2779.

declaration' : property methods can only be associated with non-static data members

The property extended attribute is incorrectly applied to a static data member.

The following sample generates C2779:

// C2779.cpp  
struct A {  
   static __declspec(property(put=PutProp))  
   // try the following line instead  
      int prop;   // C2779  
   int PutProp(void);