Darth Continent
Darth Continent

Reputation: 2319

Convert Java to C# with a tool, or manually?

I have a Java project which I'd like to convert to C#, and after looking here and elsewhere found out about a tool, Sharpen.

However, in order to get it up and running (I'm new to Java) the site linked above describes grabbing the source and building it as a plugin to the Eclipse IDE, which I'd rather not do since I don't ordinarily do Java.

Does anyone know whether a standalone EXE exists which can simply utilize Sharpen to take a given Java project and run it through the wringer to convert it to C#? Or are Java and C# similar enough that it should be pretty straightforward to just port the code over to .NET manually?

Upvotes: 18

Views: 21694

Answers (3)

Peyman
Peyman

Reputation: 3087

If the project is so big, I would say use a tool but then review it yourself and change the stupid things in the code.

Upvotes: 2

user541686
user541686

Reputation: 210705

There's no one-to-one conversion (or even close), so you should really do it manually. However, if you need a decent, automated piece of software, either as a starting point or as a rough converter, see this link.

Upvotes: 4

Jon Skeet
Jon Skeet

Reputation: 1502716

I would personally do it manually. You can reflect on where the Java design choices simply aren't appropriate for .NET, and end up with idiomatic C# code instead of code which looks very much like C# with a Java accent.

It also means you're more likely to understand the code at the end :)

Upvotes: 31

Related Questions