Dear ladies and sirs.
Imagine the following perfectly legal type hierarchy:
class A<T> where T : A<T>
{
}
class B : A<B>
{
public B():base(){}
}
My question is given a statically compiled definition of A<> is it possible to emit the type B dynamically?
The problem is how to specify the parent type in ModuleBuilder.DefineType
.
Or maybe there is another way to produce such a type, other than
- using the aforementioned method
- using CodeDom (which is much like creating a temporary file and passing it to csc.exe :-))
EDIT:
The type B
should have explicit public default constructor invoking the default constructor inherited from A<B>
.