反射和IOC

1.反射的作用

  • 它允许在运行时查看特性(attribute)信息。
  • 它允许审查集合中的各种类型,以及实例化这些类型

2.

        Assembly assembly = Assembly.LoadFrom(rootPath+ "\bin\Debug\netcoreapp3.1\WebApiDemo.dll"); //加载DLL
        Type typeObj = assembly.GetType("WebApiDemo.Model.Car");//获得类型,FullName
        object o = Activator.CreateInstance(typeObj);//创建实例
原文地址:https://www.cnblogs.com/kingsmart/p/15040761.html