序列化指向类的指针

问题描述

我有一个抽象类:

namespace Integration.Test
{
    public abstract class Employee_Integration_Test
    {
        public abstract int Run();
    }
}

我能够弄清楚如何在另一个程序集中“找到”一个类并“运行”它:

        var theAssembly = typeof(Employee_Integration_Test).Assembly;
        var TestList = theAssembly.GetTypes().Where(x => x.BaseType.Name == "Employee_Integration_Test").ToList();
        var TestType = TestList[0]; // For testing only.
        var theTest = Activator.CreateInstance(TestType) as Employee_Integration_Test;
        if (theTest != null) theTest.Run();

现在我正尝试使用XmlSerializer存储选定的类型(类)...所以:

最终,我将获得用户可以选择的可用类的列表,一旦选择,XmlSerializer将存储此信息。如何检索它并找回指针?我需要遍历反射并遍历所有类,直到得到同名的一个吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)