- input
- The expression to evaluate.
The result of computing the expression.
Evaluates the input string as a C# expression or statement and returns the value.
This method will throw an exception if there is a syntax error, of if the provided input is not an expression but a statement.
C# Example
// First setup the active using statements:
Evaluator.Run ("using System;");
int sum = (int) Evaluator.Evaluate ("1+2");
// A more interesting sample
Evaluator.Run ("using System.Linq");
Evaluator.Run ("var numbers = new int [] {1,2,3,4,5};");
// We know the result is an IEnumerator, cast it.
IEnumerator even = (IEnumerator) Evaluator.Evaluate ("from x in numbers where (x % 2) == 0 select x");