Dustin Horne

Developing for fun...

Generic Attributes in C#

First I'd like to note a correction as this original post was unintentionally misleading.  The following works with Mono but will not work with the full fledged .NET Framework.

This afternoon while doing some related research I realized that I had been doing something for awhile that appears to be somewhat of a unicorn in the C# community:  using generic attributes.  Upon further research I saw a lot of information on creating generic attributes that ranged from "you can't" to "here's how you create a custom type descriptor and dynamically inject the attribute".  As I have been doing it for awhile a much easier way, I somehow was never aware that it was a problem for some, so here is how you do it.

More...