public static void LoadDelegate()
{
// LoadDelegate wraps method into a class definition, compiles it and loads the compiled assembly.
// It returns the method delegate for the method, which matches the delegate specified
// as the type parameter of LoadDelegate
// The 'using System;' is optional; it demonstrates how to specify 'using' in the method-only syntax
var sayHello = CSScript.LoadDelegate<Action<string>>(
@"void SayHello(string greeting)
{
Console.WriteLine(greeting);
}");
sayHello("Hello World!");
}