C#中如何添加code在运行时执行 [英] C# How to add a code to execute at Runtime

查看:146
本文介绍了C#中如何添加code在运行时执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个要求可能似乎weired的许多你却是我的项目的要求之一。 是否有可能增加code在SP和NET中的EXE执行。像按钮点击我称之为SP的SP返回几行code,然后程序执行$ ​​C $ C。

I know this requirement may seem weired to many of you but it is one of my project requirement. Is it possible to add code in Sp and execute in .Net exe. Like on button click i call one SP that SP returns few line of code and then program execute the code.

是否有可能,如果是的话怎么办?

Is it possible if yes then how?

我使用的框架1.1

推荐答案

搜索'动态的C#code执行'和谷歌想出了这个博客自2002年...这可能为你工作。

Searched for 'dynamic c# code execution' and Google came up with this blog from 2002... This might work for you..

HTTP:// WWW .west-wind.com / presentations /动态code /动态code.htm

文章引用的系统。codeDom.Compiler 使用反射来执行code编译飞一集,然后。听起来很有趣;)

The article refers to System.CodeDom.Compiler to compile a assembly on the fly and then using Reflection to execute that code. Sounds like fun ;)

编辑:DaveL建议:<一href="http://stackoverflow.com/questions/826398/is-it-possible-to-dynamically-compile-and-execute-c-sharp-$c$c-fragments">Is它可以动态地编译和执行C#code片段?

As DaveL suggested: Is it possible to dynamically compile and execute C# code fragments?

这篇关于C#中如何添加code在运行时执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆