I've come across some discussion about C# and Java and it seems that a lot of programmers here in StackOverflow like C# more than java. Look here
I'm just curious if I can use the andegine library in C# using mono?
OR to be precise can I use java libraries in C# when creating an android application?
Is there a disadvantage of using C# instead of Java and if it is possible to use a Java library in C#, can you give me some example? I'm quite confused.
If you wish to use a Java library you should use Java.
It isn't possible to directly use a Java library from C#, but if you want to use C# you could:
Find a similar library that is written for .NET.
Andengine is open source. You could choose to port it to C#, though this would take a long time.
Related
I need to call CLP (a linear programming solver writen in C++) from C# .net (4.0, 4.5) in VS2013.
http://www.coin-or.org/Clp/userguide/clpuserguide.html
I have search some links about how to call C++ lib from C#.
I found the possible options:
use the C# warpper
http://astarte.csr.unibo.it/coinORwrapper/coinORwrapper.htm
Design wrapper class myself.
http://www.codeproject.com/Articles/19354/Quick-C-CLI-Learn-C-CLI-in-less-than-minutes
https://msdn.microsoft.com/en-us/library/ms235281%28v=vs.120%29.aspx
https://social.msdn.microsoft.com/Forums/vstudio/en-US/299da822-5539-4e5b-9ba7-b614e564c9f4/presenting-a-c-library-lib-for-use-in-c-project
CLP has too many classes so I try to avoid writing a wrapper class for each class. This may cause too many errors.
The first option has no English document, and has errors.
Are there other ways to call CLP from C# ?
thanks
As a third option, you have P/Invoke. But that is a mess that you should not get into if you don't know enough C++ to use C++ to call this library.
I don't know what exactly you want to do with CLP, but have you considered using other products that interface better with your language of choice? Could for example the Solver Foundation be an alternative choice?
I've recently discovered IronPython in C# and only tutorials I found were how to use python script in C#, but I've noticed, that IronPython has classes and methods you can use directly in C# like : PythonIterTools.product some_pr = new PythonIterTools.product(); and others, can anyone explain how does this work?
Parts of IronPython's standard library are implemented in C#, mainly because the equivalents in CPython are written in C. You can access those parts directly from a C# (or any other static .NET language) directly, but they're not intended to be used that way and may not be easy to use.
Is there any way to use C# classes (of a project) into another java project?
Or any other possible solution for this (like conversion - example: Java Language Conversion Assistant).
Since now, thanks.
C# -> Java
CodePorting C#2Java is a web-based tool for converting C# applications and source code into Java. (http://visualstudiogallery.msdn.microsoft.com/9789645d-9b31-4033-bcb1-53dc5ff58e05)
Google give you several options
https://www.google.com/search?q=C%23+to+Java
The idea is not to write the plugin itself using C# or C++ (although it would be nice if that were possible) but to have it access code written in C# or C++, preferably C#.
Thanks
Firefox plugins can be written using NPAPI, which is a C API, so work perfectly well from C++. (This is probably the most common language used.)
I have written some classes in C# and compiled it. Now I have the library file for these classes. Can I use the same dll with Java?
I do not want to write it in Java once again because I am writing the same program in different languages (trying to do so).
So I am making the classes to a library file and want to use it in all the programing languages.
Java normally uses a completely different runtime (inside the JVM). There are tools intending to help bridge the gap (IKVM leaps to mind), but in general: no, you can't do this. Of course, you can use IPC etc to talk between them, but they are not best friends.
One area you can look into is JNI (Java Native Interface), see http://en.wikipedia.org/wiki/Java_Native_Interface as a starting point. There are possibly easier to use bridges for .NET to Java, ah here we go, see Calling C# code from Java?
You need to searialize your code into byte, xml or json. so you can use your codes in another language