共用方式為


編譯器錯誤 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) {}
   }
};