Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
1.80/5 (5 votes)
See more:
Is there a tool can convert C++ code to C# code.Thank you.
Posted
Updated 29-Dec-17 4:26am
Comments
pasztorpisti 9-Aug-12 2:42am    
I think its better to convert your code manuall because I don't believe that such an automated translater can do good job. The tools these languages provide are quite different and they have other conceptual differences (like object lifetime). How does this compiler handle different smart pointers - just to pick something I suspect to be hard for the translator. I think the generated C# code for a non-trivial C++ code can only be garbage compared to one that has been redesigned and rewritten by a human. The problem is that often there is no one-on-one mapping because of the conceptual differences - in such cases a new design is needed and the translator won't be thinking istead of you. :-)
Volynsky Alex 9-Aug-12 11:25am    
http://forums.asp.net/t/1213219.aspx/1
http://social.msdn.microsoft.com/forums/en-US/csharplanguage/thread/cbcb354b-cfce-4084-a9de-99d6c6779f7d/
http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/b33a2d46-c2a0-45ea-a29d-2c16ac669c52/
http://www.tangiblesoftwaresolutions.com/Product_Details/CPlusPlus_to_CSharp_Converter_Details.html

 
Share this answer
 
To be honest with you, I have yet to find an automated tool that works better than the human mind. This is probably a task you want to do yourself, why? ..because you can rationalize what makes sense and what doesn't, further more, you can work as the tester in the loop simultaneously by making sure all your translations do what they're supposed to.

That's just my opinion, but I don't even like the Visual Studio wizards. They break too easily and they teach new developers to not have to learn what's really going on behind the scenes.
 
Share this answer
 
Comments
pucx 8-Aug-12 23:56pm    
I have many codes that is written by C++,I want to convert these to C#.If I convert by hand,a lot of time will waste.Thank you.
Albert Holguin 9-Aug-12 1:16am    
Why do you want to convert it anyway? Why not use it and just interface it one way or another?
pasztorpisti 9-Aug-12 5:02am    
Good point!
The best tool is an automated engine driven by precise language parsing, semantics, and rules. In the case of the CLR, you can keep your existing code and add any new features using C# rather than C++.
http://www.dapfor.com/en/net-suite/net-grid/tutorial/data-sorting[^]
 
Share this answer
 
You can use C++ code in C# with some easy steps by build an dll around the C++ code. But it depends on the code, for instance UI code isnt transferable.

Take a look at my article.
 
Share this answer
 
Comments
[no name] 13-Apr-17 10:42am    
Little bit late. I hope OP soved it in between :)
BTW: No vote from my side.

[Edit]
A 5 vote from my side to eliminate the 1.
[no name] 13-Apr-17 10:43am    
Was resurrected due to a spammer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900