What you are trying to do sounds like bad design. Attributes are not runtime types, they are in fact just type metadata. Even though some attributes allow you to change their parameters at runtime, that will not change which attribute is applied.
You will find solutions on the internet that suggest using Reflection.Emit
. Note that this is a slippery slope and will lead to highly unmaintainable code.
My personal suggestion would be to create your own Class B
that is decorated with both Attribute A
as well as Attribute B
, and then use internal logic to bridge whatever it is that you are wanting to bridge.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…