[IronPython] C# and IronPython

sms rku smsrku.2002 at gmail.com
Mon Aug 6 22:04:54 PDT 2007


Thanks Dino,
In similar lines, I can also call functions from assembly, I guess...

I have read some articles related to CodeDom, using which we can compile and
run code(C# or VB.NET) at runtime.
Which one of these two (using CodeDom OR using IronPython) is the better
approach if the requirement is to
     1. Use loops like for, while  etc -i,e call methods in a loop in the
script
     2. use script occasionally, that means scripting is not the feature
that is used regularly by the user of the application

-Thanks
sms




On 8/6/07, Dino Viehland <dinov at exchange.microsoft.com> wrote:
>
>  Yes, as long as the class is also public.  You just need to start ipy.exein the directory where your exe's at and then do:
>
>
>
> import clr
>
> clr.AddReference('MyApplication')
>
> from MyApplicationsNamespace import MyApplicationsClass  # if it's in a
> particular namespace
>
>                 or
>
> import MyApplicationsClass # if it's in the global namespace
>
> MyApplicationsClass.Main('arg1', 'arg2', 'arg3')
>
>                 Or
>
> MyApplicationsClass.SomeOtherMethod()
>
>                 Or
>
> x = MyApplicationsClass()
>
> x.SomeInstanceMethod()
>
>
>
>
>
> *From:* users-bounces at lists.ironpython.com [mailto:
> users-bounces at lists.ironpython.com] *On Behalf Of *sms rku
> *Sent:* Sunday, August 05, 2007 10:03 PM
> *To:* users at lists.ironpython.com
> *Subject:* [IronPython] C# and IronPython
>
>
>
> I am very new to Python and IronPython.
>
> Could you please let me know if it is possible to
>
> Make my application [.exe] that has a static Main method and 3 other
> public methods defined in a class to be accessed from IronPython script?
>
> i.e, Will I be able to create instance of the class from IronPython
> script?
>       Will I be able to call the public methods from the script?
>
> and also, is it possible to call the main function from the script?
>       [ i.e run my application]
>
> If yes, could you please tell me how it can be done?
>
> Thanks in advance
> sms
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20070806/5eec1bc8/attachment.htm 


More information about the Users mailing list