.NET Assembly
Load GAC Assembly
class Program
... {
static void Main(string[] args)
...{
// 动态引用GAC的Assembly
Assembly assembly = Assembly.Load("GACDemo,Version=1.0.0.0,Culture=neutral,PublicKeyToken=b821349f6886a4a6");
Type type = assembly.GetType("GACDemo.Employee");
Object employee = Activator.CreateInstance(type, new Object[] ...{ "Daniel", "R&D"} );
PropertyInfo NameProperty = type.GetProperty("Name");
string name = (string)NameProperty.GetValue(employee, null);
PropertyInfo DeptProperty = type.GetProperty("Dept");
string dept = (string)DeptProperty.GetValue(employee, null);
Console.WriteLine("Name: {0}, Dept: {1}", name, dept);
Console.Read();
}
}
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
