主班……
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1{
class Program{
static void Main(string[] args){
string className = "Demo";
string namespaceName = "ConsoleApplication1";
var myObj = Activator.CreateInstance(namespaceName, className);
Console.Read();
}
}
}
其他类....
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1{
class Demo{
public void printClassName() {
Console.WriteLine("Demo");
}
}
}
这个简单的程序有运行时错误
var myObj = Activator.CreateInstance(namespaceName, className);
线。
System.TypeLoadException {"Could not load type 'Demo' from assembly 'ConsoleApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.":"Demo"}
请帮我解决这个错误!