Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C3904

'property_accessor': must specify number parameter(s)

Check the number of parameters in your get and set methods against property dimensions.

  • The number of parameters for the get method must equal the number of dimensions of the property or be zero for nonindexed properties.

  • The number of parameters of the set method must be one more than the number of dimensions of the property.

For more information, see property.

The following sample generates C3904.

// C3904.cpp
// compile with: /clr /c
ref class X {
   property int P {
      // set
      void set();   // C3904
      // try the following line instead
      // void set(int);

      // get
      int get(int, int);   // C3904
      // try the following line instead
      // int get();
   };
};

The following sample generates C3904.

// C3904b.cpp
// compile with: /clr /c
ref struct X {
   property int Q[double, double, float, float, void*, int] {
      // set
      void set(double, void*);   // C3904
      // try the following line instead
      // void set(double, double, float, float, void*, int, int);

      // get
      int get();   // C3904
      // try the following line instead
      // int get(double, double, float, float, void*, int);
   }
};

Community Additions

ADD
Show:
© 2015 Microsoft