We don't support this in IronPython 2.0, no. And oddly, no one seems to have added this as a "desired feature" in CodePlex, even though it's come up a few times before on this list.<div><br></div><div>The most likely way that we'd initially provide support for this is to let you override the "CLS backing class" that's being used to represent your Python class -- this would mean that you'd need to do the code generation for the attribute yourself, though.<br>
<br><div class="gmail_quote">On Thu, Dec 11, 2008 at 7:58 AM, Jeff Slutter <span dir="ltr"><<a href="mailto:jslutter@reactorzero.com">jslutter@reactorzero.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Excuse me if this is known or not, but searching around has only turned<br>
up articles/mailing lists posts that are two years old, but does<br>
IronPython 2.0 support .NET attributes yet?<br>
<br>
I've seen some examples of doing it using stub classes in C# and then<br>
deriving from the in Python, but I'm not sure if this will work for me.<br>
I need to put an Attribute on a class, or method, in Python that takes a<br>
string argument. I can't think of a workaround to get this support.<br>
<br>
For example, in C# the class would be:<br>
<br>
class Foo<br>
{<br>
[MyNameAttribute("Test name")]<br>
public void Method()<br>
{<br>
Console.Write("test");<br>
}<br>
}<br>
<br>
And the string "Test name" could be different for each use of<br>
MyNameAttribute. I use it for internal registration purposes in my C# code.<br>
<br>
How would I write this class in IP?<br>
<br>
<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
</blockquote></div><br></div>