Just make an ordinary C# class, then when you compile it make sure to use the
/target:library switch. Once it's inside a .DLL file, you can use that class
from IronPython.
C# file (Example.cs):
using System;
namespace Example
{
public class ExampleClass
{
public void ExampleMethod(int i, string s, DateTime dt)
{
Console.WriteLine("{0}, {1}, {2}", i, s, dt);
}
}
}
To compile, run this at the command line (or just compile it in Visual C#):
csc /target:library Example.cs
You will get a file named Example.dll.
The IronPython file (example.py):
import clr
clr.AddReference('Example')
from System import DateTime
from Example import ExampleClass
e = ExampleClass()
e.ExampleMethod(45, "hello", DateTime.Today)
Make sure that example.py is in the same directory as Example.dll (otherwise
make sure the directory of Example.dll is in sys.path). BTW, I had problems
getting this example working in IronPython 2.0 Alpha 4, I used IronPython 1.1
instead.
- Feihong
jane janet <[EMAIL PROTECTED]> wrote: .hmmessage P { margin:0px; padding:0px
} body.hmmessage { FONT-SIZE: 10pt; FONT-FAMILY:Tahoma }
Hello all,
I wanna to know that can i create any extension file or DLL file by using C#
and if it can I wanna know how to do too.
Please help me.
Thank you.
---------------------------------
Peek-a-boo FREE Tricks & Treats for You! Get
'em!_________________________________________________
Python.NET mailing list - [email protected]
http://mail.python.org/mailman/listinfo/pythondotnet
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com _________________________________________________
Python.NET mailing list - [email protected]
http://mail.python.org/mailman/listinfo/pythondotnet