This project has moved and is read-only. For the latest updates, please go here.

Project Description
Simple but surprisingly powerful tool to quickly try out .NET fragments in C#, VB.NET and JScript.

Simply select the language you want to use, type in your code fragment and press F5 to run it:


Reusable library
Part of the source code is a library enabling you to create in-memory, executable assemblies. You can both capture their console-like output and the return value.

Sub Main()
   ' Create a compiler for C#. Also supports VB.NET and JScript
   Dim compiler As FragmentCompiler =
   ' Compile a source code fragment that returns something based on its arguments
   Dim c As CodeFragment = compiler.CompileExpression(
     "PrintLine(""Executed at "" + DateTime.Now.Ticks.ToString());" +
     "if (args.Length == 0) return ""Nothing to do!"";" +
     "if (args.Length == 1) return args[0];" +
     "return args.Length;"
   ' If compiling succeeded, run the fragment three times and display the result
   If c.Succeeded Then
     ' No arguments --> "Nothing to do!"
     ' A single argument --> "and a one"
     Console.WriteLine(c.Run(New String() {"and a one"}))
     ' More than 1 argument --> "2"
     Console.WriteLine(c.Run(New String() {"one", "two"}))
     ' On errors, dump the first error
   End If End Sub

Example: Function Plotter

A Code Fragment is also used to produce the following plot in another example program: FuncPlotter.


The source code for this form is approx. one printed page.

Last edited Mar 7, 2014 at 10:59 AM by mobzystems, version 20