34 Star 67 Fork 33

车江毅 / NScript

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
FrTest.cs 2.61 KB
一键复制 编辑 原始数据 按行查看 历史
车江毅 提交于 2016-06-24 10:21 . add project
using BSF.BaseService.NScript.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BSF.BaseService.NScript
{
public partial class FrTest : Form
{
public FrTest()
{
InitializeComponent();
this.richTextBox1.Text = @" public class B
{
//static void Main(string[] args)
//{
// System.Console.WriteLine(""hello"");
// System.Console.ReadLine();
// System.Console.ReadKey();
//}
public string test(string a)
{
return a;
}
}";
}
private void button1_Click(object sender, EventArgs e)
{
string msg = @"";
try
{
string code = this.richTextBox1.Text;
CompilerResult result = null;
var r = NScriptHelper.Run<string>(new CompilerParams()
{
EnumSourceType = Core.EnumSourceType.Code,
EnumCompilerMode = Core.EnumCompilerMode.Assembly,
CodeOrFileName = code
},
"B", "test", new object[] { "a" }, out result);
MessageBox.Show(r);
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
}
}
public class B
{
//static void Main(string[] args)
//{
// System.Console.WriteLine("hello");
// System.Console.ReadLine();
// System.Console.ReadKey();
//}
public string test(string a)
{
return a;
}
}
private void button2_Click(object sender, EventArgs e)
{
string msg = @"";
try
{
string code = this.richTextBox1.Text;
CompilerResult result = null;
var r = NScriptHelper.Run<string>(new CompilerParams()
{
EnumSourceType = Core.EnumSourceType.Code,
EnumCompilerMode = Core.EnumCompilerMode.AppDomian,
CodeOrFileName = code
},
"B", "test", new object[] { "a" }, out result);
MessageBox.Show(r);
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
}
}
}
}
C#
1
https://gitee.com/chejiangyi/NScript.git
git@gitee.com:chejiangyi/NScript.git
chejiangyi
NScript
NScript
master

搜索帮助