Breyta

Deila með


Compiler Error C3289

'property' : a trivial property cannot be indexed

A property was declared incorrectly. Accessors must be defined for an indexed property. See property for more information.

Example

The following sample generates C3289.

// C3289.cpp
// compile with: /clr
public ref struct C {
   // user-defined simple indexer
   property int indexer1[int];   // C3289

   // user-defined indexer
   property int indexer2[int] {
      int get(int i) { return 0; }
      void set(int i, int j) {}
   }
};

int main() {
   C ^ MyC = gcnew C();
   MyC->indexer2[0] = 1;
}