Compiler Error C3811

Error Message

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()

Community Additions