Using .NET's Reflection.Emit to generate an interface
.net, reflection.emit
Solution
Your question isn't very specific. If you update it with more information, I'll flesh out this answer with additional detail.
Here's an overview of the manual steps involved.
- Create an assembly with DefineDynamicAssembly
- Create a module with DefineDynamicModule
- Create the type with DefineType. Be sure to pass `TypeAttributes.Interface` to make your type an interface.
- Iterate over the members in the original interface and build similar methods in the new interface, applying attributes as necessary.
- Call `TypeBuilder.CreateType` to finish building your interface.
Problem
I need to generate a new interface at run-time with all the same members as an existing interface, except that I will be putting different attributes on some of the methods (some of the attribute parameters are not known until run-time). How can it be achieved?