Dynamically adding/removing custom attributes to/from types

  • Thread starter Thread starter Ranju. V
  • Start date Start date
R

Ranju. V

Hi,

This might sound silly, but is it possible to dynamically add or
remove custom attributes (i.e., classes derived from
"System.Attribute") to/from types?
"System.Attribute.GetCustomAttributes" gives me an array of custom
attributes already applied to an object but is there some way to add
to or remove from this list?

Thanks a lot!
 
"System.Attribute.GetCustomAttributes" gives me an array of custom
attributes already applied to an object but is there some way to add
to or remove from this list?

No



Mattias
 
This might sound silly, but is it possible to dynamically add or
remove custom attributes (i.e., classes derived from
"System.Attribute") to/from types?
"System.Attribute.GetCustomAttributes" gives me an array of custom
attributes already applied to an object but is there some way to add
to or remove from this list?

You can do it with reflection, see TypeBuilder.SetCustomAttribute
 
Back
Top