我有一个程序集asdf.dll,它有一个类'Class1'.
我怎样才能获得Class1的类型?
string a = "Class1"; //Class1 is the name of class in asdf.dll string typeString = typeof(Class1).FullName; // here I only have the string Class1 and not Class Class1 AssemblyName assemblyName = AssemblyName.GetAssemblyName("asdf.dll"); Type type = Type.GetType(typeString + ", " + assemblyName);
如何从包含类名的字符串中获取类的类型?
Type t = Type.GetType("MyDll.MyClass,Mydll")
其中MyDll.MyClass是您的欲望类/表格的类位置.Mydll是你的名字.你想打电话.