2
\$\begingroup\$

I am working on a game, sort of like this and I want to convert it to C#, as it is currently written in Python. The reason of this is because I can add features more easily and with less writing in C#, and I do NOT want to write it all again, with all of the glitches and testing having to be redone. Is there any program of internet service that can do so, for free? I don't have extra money to spend on this, which is just for fun. Thanks for all feedback, edits, and suggestions!

Edit: I use Wing IDE 4.1 for my Python coding and the Unity Version of MonoDevelop for C#.

\$\endgroup\$
6
  • \$\begingroup\$ I don't believe there's an exact PyGame equivalent for C#, so you'll have to build your code off another library. But since you've already solved all your bugs/glitches, you'll know the solution as soon as you encounter it, so it won't be as bad. \$\endgroup\$ Jun 15, 2013 at 23:54
  • \$\begingroup\$ @RobertRouhani Thanks! That's true, and I may try to use Unity for the graphics instead of using PyGame. Most of the bugs took lots of tries to fix, so hopefully it will take less time this time around :P \$\endgroup\$
    – Pip
    Jun 15, 2013 at 23:56
  • 4
    \$\begingroup\$ @PythonInProgress: will you be CSharpInProgress from now on? \$\endgroup\$ Jun 16, 2013 at 1:18
  • 1
    \$\begingroup\$ The answer is No, not an easy way. Some tools exist: developerfusion.com/tools/convert/csharp-to-python And you might be able to use IronPython and actually reuse your Python code from C#. (Just guessing here, but maybe its the same as Java & Groovy) \$\endgroup\$ Jun 16, 2013 at 2:12
  • \$\begingroup\$ @SeanMiddleditch Maybe, but probably not. I think I'll use the 'company' name I have from now on. \$\endgroup\$
    – Pip
    Jun 16, 2013 at 14:02

2 Answers 2

3
\$\begingroup\$

In general, "translating" code from one language to another (or to run on one system or another) is called a port (note interesting relation or port to portable).

Ports take a lot of work, and although there are many tools out to "help" you perform the task of porting, it's largely going to be a manual process.

If you want to program in C#, a good thing to do is just re-implement your program in C#, using your Python code base as a reference. Along the way you could find and make some improvements.

\$\endgroup\$
1
  • \$\begingroup\$ thanks @bobobobo that helps a lot more than you would think. \$\endgroup\$
    – Pip
    Jun 16, 2013 at 20:15
1
\$\begingroup\$

There is a free online tool to convert Python to C#.

https://pythoncsharp.com

This is an automated conversion, so will not be perfect but will bring across the control of flow and general structure of a script.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .