C#无法创建实例,因为Type.ContainsGenericParameters为true

bev*_*qua 9 .net c# generics reflection

我正在尝试反序列化,Generic<T> where T : struct但是当我调用时,ctor.Invoke(args); 我得到异常"无法创建实例,因为Type.ContainsGenericParameters为true".

如何传递我想要的泛型类型?

Qui*_*son 11

Type.MakeGenericType 可能就是你要找的......