mercredi 6 mai 2015

Getting Attribute Data For Return Value of .NET Method

I can call GetCustomAttributesData on a MemberInfo, which is nice because I know which constructor was called to initialize the attribute and what named arguments were used.

If I put [return: ...] on a method to attribute the return value, I can't get to GetCustomAttributesData. The only thing I can use is ReturnTypeCustomAttributes, which gets me the attributes, not their data.

Is there any way to get the attribute data via reflection for a return value of a method? Note: using GetCustomAttributesData on the MethodInfo object doesn't return attributes for the return value.





Aucun commentaire:

Enregistrer un commentaire