请帮我把C#转换成C ++ [英] Please help me convert C# to C++

查看:106
本文介绍了请帮我把C#转换成C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将C#程序转换为C ++。

I need convert a C# program to C++.

推荐答案

没有自动的方法来执行此操作,您必须手动重写。如果可以仍然使用所有CLR调用和对象,可能最好选择C ++ / CLI作为初始步骤。



每个C#类都需要在单独的头文件(.h)和实现(.cpp)文件中转换为C ++类。



您可能遇到的最大问题是类之间的依赖关系,即每个标题中需要的#include(s)以及它们冲突时应该做什么。 />
这可以通过一系列技术来解决,这些技术包括引入抽象基类并将单个类分解为公共基础和中间基础。在某些情况下,额外使用模板将适合创建mixin类,而不仅仅是C#将使用泛型的地方。

任何帮助你的人都需要知道代码库的大小和位置你打算最终结果C ++运行,Windows? Linux呢?嵌入式?跨平台?
There''s no automatic way to do this, you will have to rewrite by hand. Probably best to go for C++/CLI as the initial step if you can so that all the CLR calls and objects can still be used.

Each C# class will need to be converted to a C++ class in separate header (.h) and implementation (.cpp) files.

The biggest issue you are likely to have is dependency between classes i.e. which #include(s) you need in each header and what to do when they conflict.
This can be solved with a set of techniques that include introducing abstract base classes and factoring out single classes into common and intermediate bases. In some cases additional use of templates will be appropriate to create mixin classes and not just where C# would be using Generics.
Anyone helping you with this will need to know what the size of you codebase is and where you intend the end result C++ to run, Windows? Linux? Embedded? Cross platform?


这篇关于请帮我把C#转换成C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆