Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » General » Alternatives
 

Get CustomAttributes the easy way....

By , 16 Apr 2010
 

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

1. Get CustomAttributes the easy way....
Updated: 15 Apr 2010
I have a similar set of extension methods, but instead of MemberInfo, I used ICustomAttributeProvider, which is a more general approach as MemberInfo implements this interface. This would make the extensions usable on the types Assembly and Module to name just a few...Regards,Wouter
C#
 
2. Get CustomAttributes the easy way....
Updated: 15 Apr 2010
How about typing the 'this' parameter as ICustomAttributeProvider ?Also, ToList(...).Where(...) is bad Linq usage, becauseToList() triggers enumeration of the sequence. Try Where(...).ToList() instead.And the ToList() in 'ToList().FirstOrDefault(...)' is entirely pointless.
C#
 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Sky Sanders
Software Developer (Senior) Salient Solutions
United States United States
Member
My name is Sky Sanders and I am an end-to-end, front-to-back software solutions architect with more than 20 years experience in IT infrastructure and software development, the last 10 years being focused primarily on the Microsoft .NET platform.
 
My motto is 'I solve problems.' and I am currently available for hire.
 
I can be contacted at sky.sanders@gmail.com

| | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 16 Apr 2010
Article Copyright 2010 by Sky Sanders
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid