Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Compiler Error C3811

 

property methods 'get_accessor' and 'set_accessor' must agree on their 'static' specifier

Event accessors must agree on their use of static.

C3811 is only reachable using /clr:oldSyntax.

The following sample generates C3811:

// C3811.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>

__gc class X
{
   __property static int get_Size()
   {
      return 0;
   }

   __property void set_Size()
   {   // C3811, add static to set_Size or remove from get_Size
   }
};

int main()
{
}
Show: