[IronPython] Using Python special methods in C#

Michael Foord fuzzyman at voidspace.org.uk
Sun Jul 13 19:21:17 CEST 2008


Dan Eloff wrote:
> Something I've found a little difficult in C# is python special
> methods. It seems sometimes you can just declare them on the C# class,
> (__repr__?) and they will work, other times you need to implement an
> interface (__call__?) is there any place this is documented?
>
> I'm a little confused about how to add special methods on C# classes.
>
> I want to add __getattr__ to a C# class (actually a subclass of
> PythonDictionary), and I have no idea how.
>   

This example from Srivatsn shows you how:

http://blogs.msdn.com/srivatsn/archive/2008/04/12/turning-your-net-object-models-dynamic-for-ironpython.aspx

Michael
> Thanks,
> -Dan
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/
http://www.trypython.org/
http://www.ironpython.info/
http://www.theotherdelia.co.uk/
http://www.resolverhacks.net/




More information about the Ironpython-users mailing list