3 ms·
> It is possible to generate interface definitions in C# on the fly (at run-time), Huh, I never thought about this restriction, so you can't add a new interfac
by matthewwarren 9y ago
> It is possible to generate interface definitions in C# on the fly (at run-time),
Huh, I never thought about this restriction, so you can't add a new interface with 'Reflection.Emit', you can only add a class that implements an existing Interface, is that right?
> but unfortunately it requires going outside of the CLR or even the DLR.
By this do you mean writing raw CLR metadata yourself and then somehow injecting it into the running process or something else? Either way, its sounds like an interesting technique, any links to how it's done?
- seanmcdirmid 9y agoUsing type builder, you just set the type attributes to interface and define it otherwise like a class. See https://stackoverflow.com/questions/136528/using-nets-reflection-emit-to-generate-an-interface https://stackoverflow.com/questions/136528/using-nets-reflec...
- matthewwarren 9y agoThanks for the link, I see what you mean now