标题有点模糊.我想知道的是,如果可能的话:
string typeName = <read type name from somwhere>;
Type myType = Type.GetType(typeName);
MyGenericClass<myType> myGenericClass = new MyGenericClass<myType>();
Run Code Online (Sandbox Code Playgroud)
显然,MyGenericClass被描述为:
public class MyGenericClass<T>
Run Code Online (Sandbox Code Playgroud)
现在,编译器抱怨'找不到类型或命名空间'myType'."必须有办法做到这一点.