如何将字符串转换为命令? [英] How to Convert String to Command ?

查看:63
本文介绍了如何将字符串转换为命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想知道如何将字符串更改为命令.
例如:

字符串r ="Test";
字符串t ="MessageBox.Show(r);";


t命令==> ????

hi ,
I wanted to know how can I change a string to a command .
for example :

string r = "Test";
string t = "MessageBox.Show(r);";


t to command ==> ????

推荐答案

您必须使用反射来执行字符串.网络上有很多示例,但其中有些涉及.
You have to use reflection to execute a string. Plenty of examples on the web, but it''s a bit involved.


这篇关于如何将字符串转换为命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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