description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||
---|---|---|---|---|---|---|---|
Learn more about: Compiler Error C3289 |
Compiler Error C3289 |
11/04/2016 |
|
|
3c1c623b-7fcf-43ab-a89a-8722532a8d29 |
'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.
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;
}