托管 C 和托管 C 之间有什么区别?和C#?
我认为使用 C++ 而不是 C# 的主要优点是编译为本机代码,因此我们可以获得更好的性能。 C# 更容易,但可以编译为托管代码。
为什么有人会使用托管 C++?它给我们带来了哪些优势?
The major advantage I see for using C++ instead of C# is compiling to native code, so we get better performance. C# is easier, but compiles to managed code.
Why would anyone use managed C++ for? What advantages it gives us?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
托管 C++ 和 C++/CLI 允许您轻松编写与本机 C++ 交互的托管代码。
当将现有系统迁移到 .Net 以及在科学环境中进行必须在 C++ 中运行的计算时,这尤其有用。
Managed C++ and C++/CLI allow you to easily write managed code that interacts with native C++.
This is especially useful when migrating an existing system to .Net and when working in scientific contexts with calculations that must be run in C++.
托管 C++ 允许更轻松地在本机代码和托管代码之间进行互操作。例如,如果您有一个 C++ 库(.cpp 文件和 .h 文件),您可以将它们链接到您的项目中,并创建适当的 CLR 对象,然后只需从 CLR 对象中调用本机代码:
Managed c++ allows to more easily interop between native code, and managed code. For instance, if you have a library in c++ (.cpp files and .h files), you can link them into your project, and create the appropriate CLR objects, and simply call the native code from within your CLR objects:
(c++/cli 是新名称)您可以包装本机代码,以便与垃圾控制的 c# 完美配合,甚至还可以处理回调。相反,您可以创建托管类型并从 C++ 与它们交互。
允许开发人员轻松迁移到 C# 以试验快速构建时间等,例如 xna,链接到本机库,如上所述!
(c++/cli is the new name) You can wrap native code to work flawlessly with garbage controlled c# and even process callbacks too. Inversely you can create managed types and interact with them from c++.
Allows developers to migrate to c# easily to pilot fast build times and so on, e.g. xna, linking to native libraries, as mentioned!