转换原生 c++实例(自定义类)到对象^(系统)
我有一个本机 C++ 类,可以说“探针”。 我需要将它添加到 arrayList 中。 ArrayList的Add方法需要一个Object^。 那么我该如何转换它呢?
I have a native c++ class, lets say "probe".
I need to add it to an arrayList.
Add method of ArrayList is needed an Object^.
So how can I convert it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要使用
ArrayList
。不要将
ArrayList
用于托管对象,而是更喜欢使用通用集合之一,例如List
。不要使用
ArrayList
来保存本机对象,而是使用STL容器,例如std::vector
。ArrayList
存在的唯一原因是为了向后兼容 .NET 1.x 中编写的代码。Don't use
ArrayList
.Don't use
ArrayList
for managed objects, prefer one of the generic collections instead, such asList<T>
.Don't use
ArrayList
to hold native objects, instead use an STL container, such asstd::vector
.The only reason
ArrayList
even exists is for backward compatibility with code written in .NET 1.x.