标签: c# derived-class base-class
DerivedType x = new DerivedType ();// I don't know what
我需要按对象 x 创建对象实例。不知怎的,那样:
BaseType y = Activator.CreateInstance (Type.GetType (x));
答案 0 :(得分:1)
您可以获得基本类型:
Type baseType = x.GetType().GetTypeInfo().BaseType;
但似乎你做错了一般。