I made a generator class that builds a proxy class based on an interface that implements the interface.
See my post on Create a proxy class based on an interface without implementing it .
I am familiar with CustomAttributeData.GetCustomAttributes(MemberInfo target), I used it when I read interface members and they managed to import them into proxies.
I want to add additional attributes to the generated class at runtime. I ask attribute instances to enter them in the proxy.
For instance:
A developer can pass this as a value: new ObsoleteAttribute("Demo", true)(he has an empty constructor, but the properties are read-only), and I want to convert it to:
return new CustomAttributeBuilder(
attribute.GetType().GetConstructor(Type[] {typeof (string), typeof (bool)}),
new object[] {"Demo", true},
new FieldInfo[0],
new object[0]);
Remember, I can’t say what is given.