我正在做一个项目,在ASP.NET Web应用程序中。我无法将对象转换为接口。这是我的代码:无法将类型的Exam_Mapper投射到IMapper类型
str2 = myXmlTextReader.ReadInnerXml();
Type myTypeObj = testAssembly.GetType(str2);
Object obj = Activator.CreateInstance(myTypeObj);
Imapper EM = (Imapper)obj;
在Windows窗体应用程序中,我没有任何问题。还有下面的代码返回空值:
Imapper EM = obj as Imapper;
也许'myTypeObj'类型只是不实现'Imapper'? – sloth