[フレーム]
Last Updated: February 25, 2016
·
426
· b3ret

CSharp runtime code generator

If you need to execute C# in runtime environnement, i suggest you to take a look to this library : http://www.csscript.net/ .

Add the DLL to your project and now, just type this kind of code :

dynamic script = CSScript.LoadCode(@"namespace GenerationScript {
using System;
 using System.Windows.Forms;
 public class Script
 {
 public void ExecuteCode()
 {" +
 code +
 "}" +
 "}" +
 "}").CreateObject("*");

// execute runtime code
script.ExecuteCode();

Your project need to run under framework .NET 4.0 or more.

AltStyle によって変換されたページ (->オリジナル) /