转换原生 c++实例(自定义类)到对象^(系统)

发布于 2024-12-10 19:02:26 字数 90 浏览 1 评论 0原文

我有一个本机 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淤浪 2024-12-17 19:02:26

不要使用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 as List<T>.

Don't use ArrayList to hold native objects, instead use an STL container, such as std::vector.

The only reason ArrayList even exists is for backward compatibility with code written in .NET 1.x.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文