Rillium.Script 1.0.4

Prefix Reserved
dotnet add package Rillium.Script --version 1.0.4
                    
NuGet\Install-Package Rillium.Script -Version 1.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rillium.Script" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rillium.Script" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Rillium.Script" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rillium.Script --version 1.0.4
                    
#r "nuget: Rillium.Script, 1.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rillium.Script@1.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rillium.Script&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=Rillium.Script&version=1.0.4
                    
Install as a Cake Tool

Rillium Script 128

Rillium.Script

Rillium.Script Documentation Code Coverage

Rillium.Script provides safe scripting functionality that can be modified at runtime without the need to recompile or re-deploy your application.

Rillium.Script is designed to resemble a simplified version of C#, making it familiar to users already comfortable with C-style languages.

using Rillium.Script;

// Simple math parser
int a = Evaluator.Evaluate<int>("4 + 3 * 2");              // 10
int b = Evaluator.Evaluate<int>("var b = 4 + 3 * 2; b;");  // 10

// Supports System.Math methods
double c = Evaluator.Evaluate<double>("Log(1.5)");         // 0.4054651081081644

Try it out: https://dotnetfiddle.net/KfzpMV

Custom Functions

Register your own functions.

// Sync function
var options = new ScriptOptions()
    .AddFunction("tax", (double price) => price * 0.08);

double total = Evaluator.Evaluate<double>("tax(120) + 120;", options);  // 129.6
// Async function - use EvaluateAsync / RunAsync
var options = new ScriptOptions()
    .AddFunctionAsync("getInventory", async (int productId) =>
    {
        int count = await warehouse.GetStockCountAsync(productId);
        return count;
    });

// Script uses the async result just like any other value
int count = await Evaluator.EvaluateAsync<int>(
    "var c = getInventory(42); c > 0 ? c : 0;", options);

Calling an async-registered function via the sync Evaluate / Run path throws AsyncFunctionCalledSynchronouslyException.

Documentation

Refer to the documentation to get started with variables, loops, if-else statements, conditionals, and other essential features.

https://github.com/rilliumio/Rillium.Script/wiki

Feedback Welcome!

If you discover bugs or deficiencies, please create a new issue with an example script.

For new feature proposals, please raise them for discussion.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 150 2/19/2026
0.2.4 308 12/2/2024
0.2.3 736 12/4/2023
0.2.2 553 12/3/2023
0.1.1 763 11/28/2023
0.0.6 1,008 7/7/2023
0.0.5 751 7/5/2023
0.0.4 880 7/3/2023