views:

96

answers:

4

Hi everybody,

Somebody talking the python's code can embed into C#'s code. What the mechanism to do that? please explain for me.

Thanks a lot

+5  A: 

Use IronPython for integration with .net. Likewise, Jython integrates with Java.

ammoQ
Thank ammoQ for answer, but i want to know how IronPython embed python's code to .Net's code?
Linh
+2  A: 

And Jython for integration with Java.

David Moles
+6  A: 

There are several approaches to this, depending on which languages you want to interoperate with.

  • .Net/CLR Languages - Iron Python provides an implementation of Python running on the CLR. Allows you to use other CLR assemblies and embed a python scripting engine in your code
  • Java/JVM Based Languages - Jython provides an implementation on the JVM and allows you to use Java classes and call to call into jython as a scripting language using JSR 223 - Scripting for the Java Platform
  • C/C++/Perl/etc, etc The Simplified Wrapper and Interface Generator allows you to interop between C based languages and others, including .Net and Java. It's very good for C++, C and COM - other languages are little trickier - but worth checking out if you need to use CPython with .Net or Java
Robert Christie
A: 

thank cb160 for answer

Linh
You could always select it as the approved answer if you want? (Tick next to the answer).
Robert Christie
This should not be an answer to your question -- delete this please.
ChristopheD