Export (0) Print
Expand All
Expand Minimize

Compiler Error C3817

Error Message

'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 {
public:
   __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;
   }

private:
   int m_val[10];
};

int main() {
}

Community Additions

ADD
Show:
© 2014 Microsoft