Managed Data
Managed Data — 托管数据
其生存期由公共语言运行时管理的对象。运行时自动处理对象布局,并管理对这些对象的引用,在它们不再使用时将其释放。另请参见:公共语言运行时、垃圾回收。
这是一个 unmanaged :
class Abc{
private: int x;
public: Abc(): x(0){}
Abc(int xx): x(xx) {}
};
这是一个managed :
__gc class Bar
{
private: int x;
public: Bar(): x(0){}
Bar(int xx): x(xx) {}
};
最大的不同是使用了 __gc 关键字,__gc代表垃圾回收功能.