See the version list below for details.
dotnet add package SerializableFormula --version 2.0.0
NuGet\Install-Package SerializableFormula -Version 2.0.0
<PackageReference Include="SerializableFormula" Version="2.0.0" />
paket add SerializableFormula --version 2.0.0
#r "nuget: SerializableFormula, 2.0.0"
// Install SerializableFormula as a Cake Addin #addin nuget:?package=SerializableFormula&version=2.0.0 // Install SerializableFormula as a Cake Tool #tool nuget:?package=SerializableFormula&version=2.0.0
Serializable Formula is a fast library used to calculate a text based formula input all contained in a convienent serializable object. Add your own custom functions and variables. Calculate Boolean, String and Float outputs.
Start by creating a simple SerializableFormula object, setting the desired result type and the formula text.
var newFormula = new SerializableFormula(); newFormula.FormulaResultType = TResultType.Float; newformula.FormulaText = "Average(a, b, c, d, e)";
Defining Custom Variables
Now you have to define each part of the function. The SerializableFormula object above has no ability to process each function until you tell it what each part does.
Define your variables:
var a = new FormulaVariable("a", 4); var b = new FormulaVariable("b", 2); var c = new FormulaVariable("c", 7); var d = new FormulaVariable("d", 10); var e = new FormulaVariable("e", 20); newFormula.AddVariable(a); newFormula.AddVariable(b); newFormula.AddVariable(c); newFormula.AddVariable(d); newFormula.AddVariable(e);
var average = new TAverageFunction(); newFormula.AddFunction(average);
Average function is a custom function that comes bundled with the SerializableFormula. More about custom functions later.
VerifySyntax() function to return an object
SyntaxCheckResult which contains:
ExpressionError: A string containing a human friendly error message
ExpressionErrorToken: A string with just the erroneous text token
ExpressionErrorPosition: A integer representing the position in the formula string where the error occurs
Finally, we can obtain our result by calling the function that matches our output type:
var result = newFormula.CalculateText();
var result = newFormula.CalculateLogical();
var result = newFormula.CalculateArithmetic();
In order to create a custom function all you have to do is create a new object that implements
Once implemented you can add your function to a SerializableFormula using the
These identifiers are always a part of SerializableFormula. They cannot be used to name Functions or Variables.
|Product||Versions Compatible and additional computed target framework versions.|
|.NET||net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed.|
|.NET Core||netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed.|
|.NET Standard||netstandard2.0 is compatible. netstandard2.1 was computed.|
|.NET Framework||net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed.|
|MonoAndroid||monoandroid was computed.|
|MonoMac||monomac was computed.|
|MonoTouch||monotouch was computed.|
|Tizen||tizen40 was computed. tizen60 was computed.|
|Xamarin.iOS||xamarinios was computed.|
|Xamarin.Mac||xamarinmac was computed.|
|Xamarin.TVOS||xamarintvos was computed.|
|Xamarin.WatchOS||xamarinwatchos was computed.|
- Essy.Math.Statistical (>= 2.6.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SerializableFormula:
A WPF component that hosts a Serializable Formula
This package is not used by any popular GitHub repositories.
Integrated TFPExpressionParser Nuget package, converted from C#. A number of performance increases and removal of exposed collections.