Using C# classes with Java - c#

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

Related

call CLP (a linear programming solver writen in C++) from C# .net in VS2013

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?

Using IronPython in C#

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.

andengine for c sharp

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.

can use a library created in vb.net or c# in java?

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

Converting C# console app to VB.NET and VBA

I have to convert a C# project to VB.NET and VBA. It's a console app that uses the Microsoft Office API (Microsoft.Office.Interop.*).
My two questions:
C# -> VB.NET: .NET Reflector is a good tool for this, except that it doesn't preserve source code comments. Is there a way to do this?
.NET -> VBA: is there an automated tool to do this conversion? It would need to be a client side tool (because the code is proprietary).
The best conversion seems to be done by SharpDevelop. Open your project and from the tools menu and select convert code to. Since it has all of your c# source code it does a very good job.
There are many ways to convert C# to VB.Net; for example, try Developer Fusion.
It is not possible to automatically convert C# to VBA because the environment, language, and libraries are radically different. However, you could expose the C# code as a COM server and call it from a thin wrapper in VBA.
Answer for question #1:
You cannot use Reflector to preserve source code comments because Reflector is disassembling the compiled code, which has had all comments removed.
Consider using a commercial tool like InstantVB, which will converts C# source code into VB source code (including comments):
http://tangiblesoftwaresolutions.com/Product_Details/Instant_VB.html
You could convert the C# source code to VB.Net manually with this:
http://www.developerfusion.com/tools/convert/csharp-to-vb/
which will preserve comments. As far as automatically converting C# to VBA or VB6, I'd be willing to say that that is almost certainly going to be completely impossible. There are many aspects of C#/.Net that are not available in VBA or VB6 (like inheritance, for one).

Categories

Resources