VIR*_*IRA 5 reflection constructor c#-2.0
我想使用反射为泛型类创建一个类.
有人能告诉我如何创建它吗?
我有
public class SomeClass<T>
{
....
}
Run Code Online (Sandbox Code Playgroud)
我需要创建一个SomeClass<T>
使用反射的类.
使用MakeGenericType方法:
Type myParameterizedSomeClass = typeof(SomeClass<>).MakeGenericType(typeof(MyParameter));
ConstructorInfo constr = myParameterizedSomeClass.GetConstructor(typeof(ConstrParamType1),typeof(ConstrParamType2));
Run Code Online (Sandbox Code Playgroud)