开发者

Realtime complination in C# [duplicate]

This question already has answers here: 开发者_如何转开发 Closed 12 years ago.

Possible Duplicate:

Is there a method that will evaluate a string and produce an integer (assuming the string is an equation) in C#

Hi all, i just wonder how to make a realtime complination in C# For example: i have a string like this

string math = "1 + 2 + (4 - 6)";

And i want to complie it to get the result How to do that? and is that the bad idea because i want to make a calculator in C#?

Edited: The main question properly is that i want to do it in WP7, not exactly in C# windows lol, i tried all the solutions below but not at all is correct!


and is that the bad idea because i want to make a calculator in C#?

One problem with that is that your calculator language is probably supposed to be just a subset of C#. So using the C# compiler may be too flexible and allow arbitrary C#. Kind of like problems with SQL injection attacks.


Expresion Evalution is an application of STACK (Data Structure)

You can see these link If you want Sample projects

  1. http://www.vbforums.com/showthread.php?t=397264
  2. http://www.codeproject.com/KB/cs/runtime_eval.aspx
  3. http://www.c-sharpcorner.com/uploadfile/mgold/codedomcalculator08082005003253am/codedomcalculator.aspx
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜