Getting the .NET type of an IronRuby class

Is there a simple way of getting the .NET type of an IronRuby class?

I have this code:

resources =

where X is a class. But this doesn’t do it - I get a run time exception.

Any ideas?


Michael L. wrote:

resources =

Thanks! Yes, it’s obvious: I think I’ve got trouble switching beteen
thinking in Ruby and thinking in .NET …


resources =

or if you’d rather:

require ‘mscorlib’

def typeof(object)

On Feb 9, 2008 1:42 PM, Dermot H. [email protected] wrote:

Any ideas?


Posted via

Ironruby-core mailing list
[email protected]

Michael L.
[Polymath Programmer]

We are evaluating IronRuby and/or IronPython to use as event handling
script language in a WPF / XAML GUI project.

Our current XAML / C# design has the regular VS2008 -generated logic of
creating custom class (and enbedded BAML) for each XAML-file. We also
use heavily custom controls to build up larger panels / windows:




... ... ... ...

While I have been able to attach event handlers defined in IronPython
2.0 to the various GUI classes, I would find it more natural if I could
derive classes in Ruby from the corresponding CLR-classes:

class MyControlRuby < MyControl

def Clicked(sender, args)


However, I suspect that re-using such classes on the XAML-side would not

... ... ... ...

Can someone confirm or deny my assumption about XAML being
not-so-DLR-language-friendly here as I suppose?

Might this approach have better changes of success if I would use
IronPython 1.1 that can supposedly compile Python classes to CLR

Robert B.
Software architect
Napa Ltd
Tammasaarenkatu 3, Helsinki FI-00180
P.O.Box 470, Helsinki FI-00181

Tel. +358 9 22 813 1
Direct. +358 9 22 813 611
GSM +358 45 11 456 02
Fax. +358 9 22 813 800

Email: [email protected]