One example is that Java starts variable initializers after the superclass constructor. C # starts them earlier. This affects things if the superclass constructor then calls a virtual method overridden in the class in question. (This is usually a bad idea, but it happens.)
Then, of course, there are generics that are very, very different. For instance:
public class Foo<T> { static int counter; }
There is one counter variable in Java. In C #, there is one for the type built, so Foo<string>.counter and Foo<int>.counter independent.
I'm afraid I donโt know any tools to define this kind of thing.
I have ported Java to C # myself, and I think itโs very important to try to make the resulting code idiomatically โsharpโ as you can. For example, for example, converting getters and setters into properties, and sometimes indexers. Implementing IDisposable when necessary ... such things.
source share