[Ironruby-core] How to get to the CLR type

Tomas Matousek Tomas.Matousek at microsoft.com
Sat Jun 14 03:20:12 EDT 2008


>>> require 'mscorlib'
=> true
>>> System::String.to_clr_type
=> #<System::RuntimeType:0x000005c>

Tomas

From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero
Sent: Friday, June 13, 2008 11:13 PM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] How to get to the CLR type

I hit send to quickly there is more

If I do pass it the correct types (which I got from creating instances)
@@login_event = EventManager.register_routed_event("login", RoutingStrategy.bubble, RoutedEventHandler.new{}.get_type, LoginControl.new.get_type)

then I get a new error
RoutedEvent Name 'login' for OwnerType 'Ruby.Classes.UserControl3$3' already used.

Which leads me to believe that either I'm doing it wrong or that that's not supposed to happen/supported yet and I have to file a bug report :)

Cheers
Ivan
On Sat, Jun 14, 2008 at 5:57 PM, Ivan Porto Carrero <ivan at flanders.co.nz<mailto:ivan at flanders.co.nz>> wrote:
How do I get to the CLR type definition of a class?

I assumed that the code below would just work or at least not fail where it did :)
@@login_event = EventManager.register_routed_event("login", RoutingStrategy.bubble, RoutedEventHandler, LoginControl)

That has IronRuby complaining about the wrong type of arguments and so on.
And I figure it's because the register_routed_event method expects a CLR type instead of a DLR one. The only way I know to get to the same information as typeof(RoutedEventHandler) is to create an instance and then calling get_type on it.  Is there anoter way for that?

Cheers
Ivan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080614/7fe5b854/attachment-0001.html>


More information about the Ironruby-core mailing list