FromString
Method with 2 overloads
FromString(System.String,System.Boolean)
Summary
Converts a String to an expressionParameter "expr"
String expression, for example,"2 * x + 3 + sqrt(x)"Parameter "useCache"
By default is true, it boosts performance if you have multiple uses of the same string,
for example,
Entity expr = (Entity)"+oo" + "x".Limit("x", "+oo") * "+oo";
First occurance will be parsed, others will be replaced with the cached entity
Returns
The parsed expressionRemarks
The cache holds parses made with every setting at its default, and is neither read nor
written while a scope of any setting is open in the calling flow: a literal is rounded
as it is parsed, by PrecisionErrorZeroRange,
DecimalPrecisionContext and the other numeric settings, so
1e-20 is a number under the defaults and0 with the zero range at
1e-10 . Inside such a scope every call parses afresh.
Example
Multiple ways to parse an expression.
Entity expr1 = "a + b"; var expr2 = FromString("a + b"); var expr3 = FromString("a + b", useCache: false); var expr4 = (Entity)"a + b"; var expr5 = Parse("a + b").Switch( res => res, failure => failure.Reason.Switch<object>( unknown => throw new("Unknown reason"), missingOp => throw new("Missing operator"), internalError => throw new("Internal error") ) );FromString(System.String)
Summary
Converts a String to an expressionParameter "expr"
String expression, for example,"2 * x + 3 + sqrt(x)"Returns
The parsed expressionExample
Multiple ways to parse an expression.
Entity expr1 = "a + b"; var expr2 = FromString("a + b"); var expr3 = FromString("a + b", useCache: false); var expr4 = (Entity)"a + b"; var expr5 = Parse("a + b").Switch( res => res, failure => failure.Reason.Switch<object>( unknown => throw new("Unknown reason"), missingOp => throw new("Missing operator"), internalError => throw new("Internal error") ) );
Angouri © 2019-2026 · Project's repo · Site's repo · Octicons · Transparency · 6038 pages online