[IronPython] dynamic types

Aviad Rozenhek aviadr1 at gmail.com
Wed Aug 16 04:13:35 CEST 2006


Hi,

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.

example:
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

   -- or --

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

is there an easy way to achieve this?

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


More information about the Ironpython-users mailing list