My Life As A Blog

Ruby Tuesday #18 : Ruby meets .NET

leave a comment »

A couple of weeks ago, I posted that John Lam had announced a binary release of IronRuby.  So, I downloaded the zip file and extracted it to the root of my C drive.  That created a folder called IronRuby on my C drive containing all the IronRuby goodness.  In the IronRuby folder, there’s a bin folder in which is ir.exe, so I added C:\IronRuby\bin to my system PATH variable.  I opened a command window and typed ir and saw this:


Now that I had IronRuby running, I did the obvious stuff – putting Hello World, adding some numbers and so on.  Next, I tried calling .NET from IronRuby.  I typed the following lines into the console;

require ‘mscorlib’
require 'System.Windows.Forms, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' require 'System.Drawing, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Form = System::Windows::Forms::Form
$f =
$f.Text = “Hello World!” $f

I’m using $f (a global variable for those new to Ruby) because, as the console says, local variables aren’t supported yet in console mode.  And, this is what I saw:


.NET written in Ruby.  There’s a lot more here to explore.


Written by remark

August 12, 2008 at 7:18 pm

Posted in .NET, Development, Ruby

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: