Add attributes to methods at runtime? (C#, .NET 2.0 Reflection)
Posted on 2007-04-06
What I am hoping for is a way to accept a method pointer as a parameter in a subroutine (no problem there) and then apply attributes to that method. I am building a CAB-based (Microsoft Composite UI Application Block) application and want to encapsulate some of the functionality that the module developer will need. This is a C# project in .NET 2.0. For those familiar with CAB, I want to encapsulate the addition of a toolbar item, including creating a Command decorating the clickHandler with the CommandHandler attribute.
I am able to get the Attributes property from the method using reflection, but this doesnt have any option for Add. I don't know if what I am trying to do is even possible. I need some help. Thanks.