.net问题
我请求得到这样一段文本var busIDList=new Array();
busIDList[0]="204B";
busIDList[1]="103";
busIDList[2]="106";
busIDList[3]="108";
我怎样把这段文本转成C#代码来使用??(就是说上面这段只是读取到的字符串,我怎样将其转成直接可以用的代码?)
请高手帮忙看看!! --------------------编程问答-------------------- 是指的运行时编译吗?
可以参考:
public static CompilerResults ScriptCompiler(string _code , string[] _assmebiyNames)
{
CompilerResults result = null;
using (CSharpCodeProvider codeProvider = new CSharpCodeProvider())
{
CompilerParameters options = new CompilerParameters(_assmebiyNames);
result = codeProvider.CompileAssemblyFromSource(options, _code);
}
return result;
} --------------------编程问答-------------------- 对。
var busIDList=new Array();
busIDList[0]="204B";
busIDList[1]="103";
busIDList[2]="106";
busIDList[3]="108";
只是得到的一个字符串,我怎样直接将它转成C#代码来使用? --------------------编程问答-------------------- string _code , string[] _assmebiyNames 分别指的是什么?能否给出一段可以直接运行的代码
--------------------编程问答-------------------- 是代码转成C#的么
--------------------编程问答-------------------- 是将文本字符串转成代码使用
List<string> list = new List<string>();
list.Add("111");
list.Add("1111");
--------------------编程问答--------------------
_code 传递代码内容,例如:
using MyNamespace
public class MyClass
{
//代码内容
}
_assmeblyNames 传递引用DLL路径
例如:
System.dll
c:\abc.dll --------------------编程问答-------------------- 在后台得到该字符串后,使用split(',')将得到的字符串进行拆分成一个字符串数组,这样就可以当作C#代码来使用了。
补充:.NET技术 , C#