Depending on how you're code works in C#, the way you access it from Python may 
vary, but the basic approach is:

Compile your code as a .dll assembly, then from Python do:

import clr  # Imports the pythonnet clr stuff
clr.AddReference("myAssembly.dll")
myObjectHandle = myAssembly.myClass()
myObjectHandle.bar()



From: pythondotnet-bounces+btribble=ea....@python.org 
[mailto:pythondotnet-bounces+btribble=ea....@python.org] On Behalf Of 
munawwarah Chamroo
Sent: Thursday, February 18, 2010 1:34 AM
To: pythondotnet@python.org
Subject: [Python.NET] using c# method from python

Hi,
I am currently developing an application where i need to call some c# methods 
from my python code.
I want to know if this is possible to do using pythonnet and how to do it.

for example i have a c# class foo and in foo i have a method bar()
Now i need to call method bar() in my python code.
How should i do this.

Please help

_________________________________________________
Python.NET mailing list - PythonDotNet@python.org
http://mail.python.org/mailman/listinfo/pythondotnet

Reply via email to