How to convert Java code to C # code?

I am transferring the Java library in C #. I use Visual Studio 2008, so I do not have a discontinued Microsoft Java Language Conversion Assistant (JLCA) program.

My approach is to create a new solution with a similar project structure in the Java library and then copy the Java code into a C # file and convert it to a valid C # line by line. Given that I find Java easy to read, the subtle differences in the two languages ​​surprised me.

Some things were easy to port (namespaces, inheritance, etc.), but some things were unexpectedly different, such as the visibility of private members in nested classes, overriding virtual methods, and behavior of built-in types. I do not quite understand these things, and I am sure that there are many other differences that I have not yet seen.

I have a long way to go about this project. What thumb rules can I apply during this conversion to properly manage language differences?

+5
source share
6 answers

You do this in the only reasonable way you can ... the biggest help will be in this document from Dare Obasanjo, which lists the differences between the two languages:

http://www.25hoursaday.com/CsharpVsJava.html

BTW, getter setter ... # , java, .

+3

:

  • J # - Microsoft Java .NET. Java ( 1.4 *, ). * Java 1.1.4 java.io/lang,   1.2 java.util + , J #   ~ 2015-2017 J # 2.0 redist

  • Mono IKVM Java CLR, .NET. .

  • Microsoft Visual Studio 2005 " Java ", Java # .

+3

, , , .

, :

  • , .
  • script (Ruby Perl ), - ! / . /, .
+1

: IKVM Java-jar .NET, Reflector - FileDisassembler Add-in - Visual #.

(, IKVM - - , ?)

+1

, , . , Java- , , , , Java.

0

I heard something the other day about the .net version of Java. If such a monster were available, could you just compile the java source in the .net intermediate libraries?

0
source

All Articles