C # can establish a Class type object according to the class name as Java

zhaozj2021-02-16  80

http://community.9cbs.net/expert/topic/3214/3214785.xml?temp=.3455316activator.createInstance (ClassName) Q: Can you define the class you can? How do I get the reference to this object? ? Assembly a = Assembly.LoadFrom ( "employee.dll"); Type t = a.GetType ( "Company.Employee"); MethodInfo getsalary = t.GetMethod ( "DisplayMsg"); object obj = Activator.CreateInstance (t); ...

转载请注明原文地址:https://www.9cbs.com/read-12300.html

New Post(0)