using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp5
{
class Program
{
static void Main(string[] args)
{
// 按照路径获取dll
Assembly assembly = Assembly.LoadFrom(@"test.dll");
// 获取dll中的DllClass类
Type dc = assembly.GetType("medullaAdapter_m.medullaAdapter_m");
System.Attribute[] attrs = System.Attribute.GetCustomAttributes(dc); // reflection
//{get;set;}
var props = dc.GetProperties();
// 实例化该类
object obj = Activator.CreateInstance(dc);
}
}
}
c#加载dll,获取类里的属性,实例化对象
最新推荐文章于 2024-04-30 03:57:31 发布