[IronPython] dynamic types

Aviad Rozenhek aviadr1 at gmail.com
Tue Aug 15 19:13:35 PDT 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: /pipermail/users-ironpython.com/attachments/20060816/1dbbb6a9/attachment.htm


More information about the users mailing list