Edit

Share via


Compiler Error C3155

attributes are not allowed in a property indexer

An indexed property was declared incorrectly. For more information, see How to: Use Properties in C++/CLI.

Example

The following sample generates C3155.

// C3155.cpp
// compile with: /clr /c
using namespace System;
ref struct R {
   property int F[[ParamArray] int] {   // C3155
   // try the following line instead
   // property int F[ int] {   // OK
      int get(int i) {
         return 0;
      }
   }
};