Saturday, June 23, 2012

GetCustomAttributes Sucks

Ok so maybe the title of this post is a little harsh.  I don't really have anything against the MemberInfo.GetCustomAttributes.  I just don't like writing code like the following:


I'd prefer to do something like this:


Here is the source for the GetAttribute extension method:


You can download the full source (with tests) on GitHub here.

No comments:

Post a Comment