asp.net网站项目中使用Type.GetType获取对象为NULL
类均在APP_Code文件夹中
定义了一个借口:
public interface IMethodExample
{
string Method();
}
public class MethodExample: IMethodExample
{
public string Method()
{
string str = " 1234567 ";
return str;
}
}
IMethodExample tt= Type.GetType("MethodExample") as IMethodExample;
Response.Write(tt == null);
IMethodExample tt = Activator.CreateInstance(Type.GetType("命名空间.MethodExample")) as IMethodExample;