编译器错误 C3799

索引属性不能有空的参数列表

索引属性未正确声明。 有关详细信息,请参阅如何:在 C++/CLI 中使用属性

示例

下面的示例生成 C3799,并演示如何修复此错误。

// C3799.cpp
// compile with: /clr /c
ref struct C {
   property int default[] {   // C3799
   // try the following line instead
   // property int default[int] {
      int get(int index) { return 0; }
      void set(int index, int value) {}
   }
};