Using IronPython in C# - 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.

Related

MATLAB class in .NET

I have some custom classes in MATLAB and I want to use them in my C# project. I read a little bit and used deploytool to generate dll files. Sadly, its not working as I expect it to work. The classes are exported as methods and I cant access properties.
I read here and it says you cant export MATLAB class to C/C++ ( I assume not as a .NET assembly either). Is there a way around it?
I have huge amount of code in MATLAB, and its best if I use it directly than re-writing in C#.
There exists a Matlab to .net porting utility see here :
http://www.mathworks.com/products/netbuilder/

How to call a c# dll from java program

I have a c# dll that needs to be called in Java.I see that there is a method using jni to call c++ dlls.How can I do it for a c# dll..Please help..I couldnt find any good material on this
From here:-
IKVM.NET is an implementation of Java for Mono and the Microsoft .NET
Framework. It includes the following components:
A Java Virtual Machine implemented in .NET
A .NET implementation of the Java class libraries
Tools that enable Java and .NET interoperability
You can use Java Native Interface. Or you can create a COM assembly from the C# code and use J-Interop to invoke it.
If you have C# dll sources you need to use maybe the better way will be to translate it to Java using some tools like GrassHopper.
According to GrassHopper key feature explanation it can convert MSIL to Java bite code. So can use without sources of c# dll
Check this: http://www.javonet.com
If you look for quick and easy solution then Javonet should work fine for you. It is light counterpart of IKVM and J-Integra works also as native bridge.
All you have to do is:
add Javonet.jar do your project call
call Javonet.addReference("yourlib.dll")
use your .NET library like it was almost JAVA package
Sample:
NObject obj = Javonet.New("yourDotNetClass");
obj.invoke("YourMethod","arg1", 2);
The syntax is not strongly-typed and works like reflection but gives you fastest access to any custom .NET code, third-party libs or .NET framework as no changes are needed on .NET side. If you need it is also possible to implement custom strongly-typed wrappers.
I do recommend this bridge as in my opinion it is easiest to quickly get things done but also other native bridges are worth checking as this is best approach for such case.
I would avoid going into custom JNI or COM unless you have a lot of time and you just want to learn, if you need quick and reliable solution take one of third-party bridges.

Using C# classes with Java

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

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

Categories

Resources