这里 创建 对象后 还返回接口 IdbInterface
public static IdbInterface CreateObj(string ClassName )
{
Assembly assembly = Assembly.GetExecutingAssembly(); //获取包含当前代码的程序集
string[] space_name = assembly.FullName.Split(",") ; //获取名称
object o = assembly.CreateInstance($"{space_name[0]}.{ClassName}"); //这里所述的完整类名指的是包括名称空间,即:名称空间.类名
return o as IdbInterface; //强制类型转换
}
创建IDB接口对象
本文介绍了一种通过指定类名创建并返回IDB接口对象的方法。该方法利用反射机制从当前程序集中实例化指定的类,并将其转换为IDB接口类型。
570

被折叠的 条评论
为什么被折叠?



