📅  最后修改于: 2022-03-11 14:48:48.529000             🧑  作者: Mango
Type generic = typeof(Dictionary<,>);
// Create an array of types to substitute for the type parameters of Dictionary. The key is of type string, and the type to be contained in the Dictionary is Test.
Type[] typeArgs = { typeof(string), typeof(Test) };
// Create a Type object representing the constructed generic type.
Type constructed = generic.MakeGenericType(typeArgs);
var instance = Activator.CreateInstance(constructedType);