I'm just wondering if this is even possible; how to do non-complicated scripting within C#. Basically, let's say I have a structure as such:
Structure
int a
int b
int c
Function ParseValue(pString as String)
try
return interpret(pString)
catch
return 0
end try
End Function
ParseValue would be where my question lies, specifically 'interpret'. 'Interpret' is just a generic placeholder for what code/implementation that I'm looking for.
Let's say I pass in a value for pString as 'a + b + c'. So, the code would the interpret the string as "return the value of adding a + b + c" together. And If I cannot do that, "return 0". A good example of having to return 0 would be "(a + b) / c", and the value of c = 0 (cannot divide by zero).
Is it possible to do this? I know A LONG time ago Iwas able to use the Microsoft Scripting Control to achieve similar fuctionality in VB6, but yah. That's 12 years ago, and not C#/XNA/360 compatible. I think :P
EDIT: The language that can be interpreted doesn't matter. If I can use VB.Net or C# and interpret VBSCript or JScript in it, I'm happy with that.