c# - How to execute code that is in a string? -
possible duplicates:
c# eval equivalent?
c# execute string code
say have this:
string singlestatement = "system.datetime.now";
is there way take singlestatement
, parse , run @ run time?
so that:
datetime currenttime = singlestatement.somecoolmethodtorunthetext();
would assign value of datetime.now
currenttime
.
this possible using compiler services , reflection.emit()
compile , assembly , load memory.
have here.
Comments
Post a Comment