In our project 98% of attributes are on class definition and properties. The 2% left are field attributes, [field: NonSerialized()], on user defined events.
On Feb 5, 2008 1:07 AM, Keith J. Farmer <[EMAIL PROTECTED]> wrote: > 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 > > > ________________________________ > > > 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... :) > _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com