My personal experience says that the most prevalent use of attributes in .NET 
*is* on methods and properties, as part of the original class definition.
 
Consider:
 
LINQ to SQL: http://msdn2.microsoft.com/en-us/library/bb386971.aspx
 
WCF: 
http://linqinaction.net/blogs/jwooley/archive/2007/05/14/wcf-with-the-linq-to-sql-designer.aspx
 
 
XML Serialization: 
http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=236 
 
 

________________________________

From: [EMAIL PROTECTED] on behalf of Curt Hagenlocher
Sent: Mon 2/4/2008 3:46 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Decorators on classes



On Feb 4, 2008 3:29 PM, Michael Foord <[EMAIL PROTECTED]> wrote:
>
> It is rather ugly. :-)

Thanks; I thought so myself.

> Would this technique have anything to offer for attributes on methods
> and properties (etc).

It's hard to see how, but it's been a while since I looked at that
part of the source.  I'm pretty sure that the CLR class itself needs
to be emitted entirely by the contents of the one "class" statement --
and well before the first method is defined.  Which means that none of
the properties or methods of the class could influence codegen.

Frankly, I don't think that attributes on methods or properties are
realistic -- at least, not as part of the original class definition.
What I think you'd be looking at is the ability to define a class
wrapper that wraps the initially-defined dynamic class with a new
statically-defined class that allows you to put attributes on methods
and properties.  Hmm... where have I heard that recently... :)

--
Curt Hagenlocher
[EMAIL PROTECTED]
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to