• Post Reply Bookmark Topic Watch Topic
  • New Topic

C# to java translator  RSS feed

 
swati mittal
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I have a code written in C# which is using delegates.
I need to convert it into java code.
I tried it to convert it manually but am facing problem in delegates.
Do you know any tool that can convert it automatically.
Please help me to solve this issue.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if it can be done automatically, but manually you could solve it by using interfaces. In fact, a delegate is not a lot more than an interface with one method. Instead of passing an instance of the interface, you pass the method directly.
 
Stephen Foy
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to take a look at this.

https://net2java.dev.java.net/
 
Pat Farrell
Rancher
Posts: 4686
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by swati mittal:
Do you know any tool that can convert it automatically.


Automatic converting from one language to another is nearly always possible, and always a bad idea. You end up with code that looks like C++ written in Java.

Much better, IMHO, to convert the concepts from one language to another.
 
swati mittal
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to all for your quick response.
I will follow the instructions given by you.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!