Skip to content
rvernagus edited this page Sep 13, 2010 · 4 revisions

IronRubyInline allows you to compile C#, Visual Basic, or even F# inline with your IronRuby code. IronRubyInline adds a compile method to String. This allows you to store code in the language of your choice right in your IronRuby files. Call compile and you have access to classes defined in the String:

%Q{
public class Cat
{
    public void Greet()
    {
        System.Console.WriteLine("Hai u!");
    }
}
}.compile

cat = Cat.new
cat.greet # Hai u!

Behind the scenes, IronRuby has compiled your code into a temporary assembly and the assembly has been referenced and loaded into your program. These assemblies are statically compiled into the language of your choice so performance and other characteristics should match those of assemblies produced by any other means.

Clone this wiki locally