[IronPython] dynamic types

Martin Maly Martin.Maly at microsoft.com
Wed Aug 16 16:52:12 CEST 2006

You can implement ICustomAttributes interface on your class (defined in IronPython\Runtime\Interfaces.cs) and IronPython will do the right thing.


From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aviad Rozenhek
Sent: Tuesday, August 15, 2006 7:14 PM
To: users at lists.ironpython.com
Subject: [IronPython] dynamic types


I have a C# class with the following design

public interface IDynamicProperty
/// ...

public class DynamicPropertiesContainer
   IDynamicProperty GetDynamicProperty (string name)

and I have embedded IP as an internal scripting langauge.

what  I would like is to expose the "DynamicProperties" of my class as "actual" properties in IP, which is logical since IP is dynamic.

I want the following IP code to be equivalent (assuming that 'container' is an object of type DynamicPropertiesContainer)

print container.GetDynamicProperty ("name")
print container.name<http://container.name>

   -- or --

print container.GetDynamicProperty ("phone_number")
print container.phone_number

is there an easy way to achieve this?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060816/3ce5934d/attachment.html>

More information about the Ironpython-users mailing list