我想存储指向本地类System::Object^
和检索回来。存储和检索系统原生指针:对象^
class ABC;
ABC * d = new ABC();
System::Object^ Tag;
Tag = d; //This throws an error
//in a different function
ABC * c = safe_cast<ABC*>Tag; // this throws an error.
哪种方法可以达到上述目的?
我想存储指向本地类System::Object^
和检索回来。存储和检索系统原生指针:对象^
class ABC;
ABC * d = new ABC();
System::Object^ Tag;
Tag = d; //This throws an error
//in a different function
ABC * c = safe_cast<ABC*>Tag; // this throws an error.
哪种方法可以达到上述目的?
使用IntPtr的结构,而不是对象。
IntPtr Tag(d); ABC * c = (ABC*)Tag.ToPointer();
你不能只保存本机的指针?为什么它必须是一个对象? – stijn 2011-06-08 06:35:37
它的ListViewItem的标记属性。 – User234 2011-06-08 06:38:39