using the FastMember library from NuGet, I am able to find all the members of a type that are decorated with a particular attribute, using this code:
var accessor = TypeAccessor.Create(typeof (MyData));
var decoratedMembers = accessor.GetMembers().Where(x=>x.IsDefined(typeof(MyDecorationAttribute));
That's all very well and good, but I need to now be able to get the specific instance of MyDecorationAttribute
for each of the members in decoratedMembers
MemberSet
and as far as I can see there isn't a way to do that.
Am I missing something? Perhaps there's a different library that I should be using to get the attribute data per member, or is stock Reflection the way to go in this case.
This is not alternative to fast-member but, it has Private Member support, Attribute support and Caching. Here is SlowMember
Usage:
Github Repository: https://github.com/efaruk/slow-member
First and foremost - Marc, thank you very much for an AWESOME library!
Second, please forgive me Marc, for I am about to sin...
I have had the same problem - a desire to access a MemberInfo about the member, but library lets me "sniff" it, but not to access it.
With a bit of help from http://www.codeproject.com/Articles/80343/Accessing-private-members.aspx
Usage: