ICodeCompiler comp = new CSharpCodeProvider().CreateCompiler();
CompilerParameters cp = new CompilerParameters();
cp.ReferencedAssemblies.Add("system.dll");
cp.ReferencedAssemblies.Add("system.data.dll");
cp.ReferencedAssemblies.Add("system.xml.dll");
cp.GenerateExecutable = false;
cp.GenerateInMemory = true;
StringBuilder codes = new StringBuilder();
codes.Append("using System; \n");
codes.Append("using System.Data; \n");
codes.Append("namespace Test \n");
codes.Append("{ \n");
codes.Append(" public class TestClass \n");
codes.Append(" { \n");
codes.Append(" public static string TestMethod() \n");
codes.Append(" { \n");
codes.Append(" return ""; \n");
codes.Append(" } \n");
codes.Append(" } \n");
codes.Append("} \n");
CompilerResults cr = comp.CompileAssemblyFromSource(cp, codes.ToString());
after I compiled this class succesfully and used the method by invoke method successfully, I used GetType("Test.TestClass") then return null. what's wrong?