The Jep class is the main interface with which the user should interact. It contains all necessary methods to parse and evaluate expressions.

To evaluate an expression, simply call the Parse(String) and Evaluate methods after each other. The following code snippet shows a parsing and evaluating a simple expression with a single variable:

Examples

CopyC#
JepInstance jep = new JepInstance();
jep.AddVariable("x", 10);
try {
    jep.Parse("x+1");
    Object result = jep.Evaluate();
    System.Console.Out.WriteLine("x + 1 = " + result);
} catch (Exception e) {
    System.Console.Out.WriteLine("An error occured: " + e.getMessage());
}

The class is serializable. Please see the documentation section "Serialization" for more information on the various options for serializing.

Namespace:  SingularSys.Jep
Assembly:  Jep (in Jep.dll) Version: 1.1.0.0 (1.0.0)

Syntax

C#
[SerializableAttribute]
public class JepInstance
Visual Basic (Declaration)
<SerializableAttribute> _
Public Class JepInstance
Visual C++
[SerializableAttribute]
public ref class JepInstance

Inheritance Hierarchy

System..::.Object
  SingularSys.Jep..::.JepInstance

See Also