编译器错误 C3902

“accessor”: 最后一个参数的类型必须是“type”

至少有一个 set 方法的最后一个参数的类型必须与属性的类型匹配。 有关详细信息,请参阅 property

下面的示例生成 C3902:

// C3902.cpp
// compile with: /clr /c
using namespace System;
ref class X {
   property String ^Name {
      void set(int);   // C3902
      // try the following line instead
      // void set(String^){}
   }

   property double values[int,int] {
      void set(int, int, float);   // C3902
      // try the following line instead
      // void set(int, int, double){}
   }
};