能否在托管类型中创建一个引用类型?
这一句话怎么理解:(.net2005msdn中gcnew文档)
It is possible to create an instance of a managed type, where the managed type contains a nested type other than a reference type。
我理解的是:在托管类中不能包含有引用类型。
但是我在.net2005种实际运行了一下这个代码,并且实例化,它能够运行。
ref class MyClass {
public:
System::String ^msg;
ref class Value_Nested_Class {
public:
System::String^ msg;
};
// Value_Nested_Class My_Value_Class;
void Test() {}
};
但是将注释掉的内容启用,会出现链接时错误:
error LNK2022: 元数据操作失败(80131188): 重复类型中的字段声明不一致(类型: MyClass;字段: My_Value_Class): (0x04000002)。
怎么解释?期待讨论?
至于那句英文句子有没有什么更准确的解释?