-1

I need to develop C# application where a user can call some customized functions that have been developed by us, that have to be executed at run time.

For example, suppose I have developed a class which has the following methods:

  • Sum(params int[] values )
  • GreaterThan(int Value,int CompareValue).

Now I want to provide a User Interface to the user, where they can call these in nested manner. For example:

GreaterThan(Sum(1,5,6,8),15)

My application then will then parse this and execute the functions accordingly. How do I approach this?

Hope my requirement is clear and will get some solutions to this.

CharithJ
  • 46,289
  • 20
  • 116
  • 131
  • 1
    You want to say that user can type: GreaterThan(Sum(1,5,6,8),15) , press button and see results? – kat1330 Nov 23 '16 at 04:54
  • 1
    *my requirement*, you requirement is to write code for you, not to fix a problem with your code. Show the effort and code you tried, and if you hit a *specific* problem, then come ask the question, we will be glad to help out. – Jim Nov 23 '16 at 05:02
  • Is this a console application or you are using other GUI ? How the user will give input ? by typing or by clicking a button ? – lukai Nov 23 '16 at 05:03
  • Your _"requirement is clear"_ but you won't _"get some solutions"_ because your question is **too broad**. Your question sort of reads as a set of requirements. Any code to show? What research have you done? These things will help us help you. Good luck! _[How do I ask a good question?](http://stackoverflow.com/help/how-to-ask)_ –  Nov 23 '16 at 05:07
  • Yes Kat. I want user can type such functions on my application. – Brijesh Nov 23 '16 at 07:32
  • Kat, I have just started this project and want to understand either there is any library or any specific technique on which I should look in. That will make my task easier. – Brijesh Nov 23 '16 at 07:47

1 Answers1

0

You can use NCalc mathematical expressions evaluator, it can evaluate expressions, for example

Expression e = new Expression("2 + 3 * 5");
Debug.Assert(17 == e.Evaluate());

for your requirements, you may need to write your own functions, check below answer : How to add a new function to Ncalc

Community
  • 1
  • 1
Damith
  • 62,401
  • 13
  • 102
  • 153