1

Possible Duplicate:
How can I evaluate a C# expression dynamically?

I have one string in csharp

string li_id = "Frm_menu_purchase_order.visible=false;";

Now i wanna execute this string value as a c sharp statement

just like

Frm_menu_purchase_order.visible=false;
1

3 Answers 3

1

Description

You can use the Evaluator class found on Codeproject.

Check out Evaluate C# Code (Eval Function)

The class uses CodeDom do make this possible. But i suggest you are looking for another solution instead of using the Evaluator. But it works!

More Information

Sign up to request clarification or add additional context in comments.

2 Comments

Your link is invalid (gives The resource cannot be found error)
Sorry, link is fixed. Thank you very much!
0

Use Reflection, please see below:

http://www.codeproject.com/KB/cs/evalcscode.aspx

Comments

0

You can use the CodeDom: http://www.codeproject.com/KB/dotnet/CodeDomDelegates.aspx

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.