Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 868 Bytes

compiler-error-c3289.md

File metadata and controls

37 lines (30 loc) · 868 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Error C3289
Compiler Error C3289
11/04/2016
C3289
C3289
3c1c623b-7fcf-43ab-a89a-8722532a8d29

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;
}