C#动态编译如何调用非动态编译的类

这个不动态编译
using System;
namespace a
{
public delegate string Call();
public class Test1
{
public event Call c;
public string Say()
{
return "hello world";
}
}
}

这个动态编译
using System;
namespace b
{
class Test2
{
public static string Hello()
{
return "hello world";
}

public static void Band(a.Test1 t)
{
t.c+=b.Test2.Hello;
}

}
}

动态编译出错怎么解?
谢谢
这个逻辑不太通

改一下
using System;
namespace a
{
public delegate string Call();
public class Test1
{
public event Call c;
public string Say()
{
return c();
}
}
}

问题经检测就是出现在了动态的编译里出现了“a.Test1”
去掉这个方法就能通过

你用的什么编译方式,CodeDom的话,
编译时有CompilerParameters.ReferencedAssemblies这个属性,把你的a添进去再编译。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-07-21
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class test
{
public static void main(String[] args)throws Exception
{
int[] b=new int[200];
int[] c=new int[200];
int i, j;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str=null;

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网