Connect C# parametric tables to LIONoso

(preliminary version. will be completed with figures soon)
An external C# program to LIONoso can be connected to LIONoso, as a Parametric Table. A high-level description of the Parametric Table tool is available here: Using parametric table scripts in LIONoso

As for the other languages, a C# program must obey the following rules in order to communicate with LIONoso:

  • When invoked without input parameters, the program must output the description of the parameters it expects to receive.
  • When called with input parameters, the last parameter is the name of the output file where to store the CSV representation of the table. Do not write directly to this file, to avoid the situation in which LIONoso reads some inconsistent data. The correct way to output the results is to write into a temporary file, and rename it to the destination file only after all the data are written.

C# Helper class (courtesy of Ray Henry)

Ray Henry kindly provided a helper class which eases the development of a parametric table using C#. The LionRunner.cs source file contains the implementation of the LionRunner class, which communicates the parameters configuration to LIONoso and stores the resulting table into the CSV file.

A simple example of use of this helper class, is provided by this example CoinFlip.cs, which generates a table counting the heads obtained by flipping a set of coins, launching a configurable number of repetitions of the experiment.

You need to override the functions "SetupParameters" and "Run" depending on what you want to accomplish. Compile your program and load the executable file (.exe) as a Parametric Table.

Mono and MacOSX

Under MacOSX, you can use Mono to build and run C# programs. The .exe file generated by the compiler is not automatically executable, (LIONoso cannot call your program). A solution is to provide a simple .command file (CoinFlip.command for the previous example) which calls the correct command line forwarding the command line arguments to the program. The content of the .command file is:

	mono Your_Program.exe $@

After connecting your program, plot a barchart with the newly created data to obtain the following visualization.