This documentation is archived and is not being maintained.

Compiler Error C3817

'declaration' : property can only be applied to a function

The property keyword can only be a applied to a function definition.

C3817 is only reachable using /clr:oldSyntax.

The following sample generates C3817:

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

__gc class G {
      __property int x;   // C3817

// the following class defines a property
__gc class X {
   __property int get_N( int i ) {
      Console::WriteLine( L"int" );
      return m_val[i];

   __property void set_N( int i, int val ) {
      m_val[i] = val;

   int m_val[10];

int main() {