编译器错误 C3914

默认属性不能是静态的

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

示例

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

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