C# code
C# runs through .NET compiled to WebAssembly, with the Roslyn scripting engine. The runtime is embedded in Restorm: no .NET SDK is required on your machine.
The API
Section titled “The API”| Symbol | Role |
|---|---|
input | The value received on the input port |
vars | A dictionary of the run variables |
Console.Write / Console.WriteLine | Write to the execution log |
| The final expression | Its value leaves on the result port |
The code is C# script (Roslyn style): no enclosing class and no Main to
write, the statements are at the top level, and the final expression is the result.
Example
Section titled “Example”using System.Linq;using System.Text.Json;
var doc = JsonDocument.Parse(input.ToString());var commandes = doc.RootElement.GetProperty("commandes").EnumerateArray();
var payees = commandes .Where(c => c.GetProperty("statut").GetString() == "payee") .ToList();
var total = payees.Sum(c => c.GetProperty("montant").GetDouble());
Console.WriteLine($"{payees.Count} commandes payées, total {total} €");
new { nombre = payees.Count, total }What is available
Section titled “What is available”.NET’s base class library: System.Linq, System.Text.Json,
System.Text.RegularExpressions, System.Security.Cryptography,
System.Collections.Generic…
Limitations specific to C#
Section titled “Limitations specific to C#”This is the language to pick when you want to reuse business logic already written in C#, or when your team is more comfortable with it — not when you need to call something.