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

 

Martin

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aviad Rozenhek
Sent: Tuesday, August 15, 2006 7:14 PM
To: [email protected]
Subject: [IronPython] dynamic types

 

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")

 

   -- or --

 

print container.GetDynamicProperty ("phone_number")

print container.phone_number

 

is there an easy way to achieve this?

 

thanks

A.

 

 

_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to