编译器错误 C3813

属性声明只能在托管类型或 WinRT 类型的定义内出现

property 只能在托管类型或 Windows 运行时类型中声明。 本机类型不支持 property 关键字。

示例

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

// C3813.cpp
// compile by using: cl /c /clr C3813.cpp
class A
{
   property int Int; // C3813
};

ref class B
{
   property int Int; // OK - declared within managed type
};