Question

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

Was it helpful?

Solution

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

OTHER TIPS

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

And Jython for integration with Java.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top