编译器错误 C3155

属性索引器中不允许使用属性

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

示例

下面的示例生成 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;
      }
   }
};