Expression

References
[IoId("00000000-1369-45e5-9517-944544f770d8")] public sealed class Expression : IStorable
Represents an expression for a specific input output type.

Constructors

Expression

#
public Expression(
reader
)

Properties

CompilerCode

#
Gets the modified source code that was used to compile this expression.
public string CompilerCode { get; }

Identity

#
Gets an identity expression for a single variable 'x'.
public static Expression Identity { get; }

NaN

#
Gets an expression which always returns double.NaN.
public static Expression NaN { get; }

Undeclareds

#
Iterate over all global variables in this expression. This expression probably cannot be evaluated unless a Resolver is supplied which provides values for all these globals.
public IEnumerable<string> Undeclareds { get; }

UserCode

#
Gets the source code with which this expression is associated.
public string UserCode { get; }

Zero

#
Gets an expression which immediately returns zero.
public static Expression Zero { get; }

Methods

Constant

#
Create an expression with a constant return value.
public static Expression Constant(
code,
value
)

Evaluate

#
Evaluate this expression. If the expression relies on external variables, you cannot use this overload.
public object Evaluate()
The result of the expression.

Evaluate

#
Evaluate this expression.
public object Evaluate(
resolver
Variable resolver. You only need a resolver if the expression contains undeclared variables.
)
The result of the expression.

EvaluateSafe

#
Evaluate this expression. Any exceptions thrown during evaluation will be returned as a string instead.
public object EvaluateSafe()
Result of expression or a string describing why it failed.

EvaluateSafe

#
Evaluate this expression. Any exceptions thrown during evaluation will be returned as a string instead.
public object EvaluateSafe(
resolver
Variable resolver. You only need a resolver if the expression contains undeclared variables.
)
Result of expression or a string describing why it failed.

GetHashCode

#
Gets a hash for this expression.
public override int GetHashCode()
Explicit

IStorable.Store

#
void IStorable.Store(
writer
)
Store

HasUndeclareds

#
Test whether this expression has any undeclareds other than the provided list.
public bool HasUndeclareds(
params string[]
ignoreList
List of undeclared variable names to ignore.
)
True if there's at least one undeclared variable with a name not on the list.

ToString

#
Gets a string description of this expression.
public override string ToString()
Object.ToString

TryCreate

#
Try and create an expression. This method doesn't throw.
public static Expression TryCreate(
userCode,
Expression code.
out string
message
Message in case of failure.
)
Expression or null.

TryCreate

#
Try and create an expression. This method doesn't throw.
public static Expression TryCreate(
userCode
Expression code.
)
Expression or null.

Variable

#
Create an expression with a direct variable lookup.
public static Expression Variable(
name
)