[Ironruby-core] call an overloaded constructor??

Tomas Matousek Tomas.Matousek at microsoft.com
Thu Nov 12 19:07:45 EST 2009


CLR DateTime type is currently mapped to Time Ruby class, so "new" uses only Ruby constructors to be compatible. However, you can use clr_new to call the CLR constructor for any CLR type with a public constructor:

Time.clr_new(2009, 9, 28)

You can also get the constructor method and call it like so:

Time.clr_ctor.call(2009, 9, 28)

This is useful when there are multiple overloads of the constructor among which we are not able to choose based upon the types of the actual arguments.

Tomas

From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Patrick Brown
Sent: Thursday, November 12, 2009 3:49 PM
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] call an overloaded constructor??

Hi

   Is there a way for me to call an overloaded constructor??  I want to say   date =  new DateTime(2009,9,28) using IronRuby 0.9.2.  I have been searching quite a bit and haven't seen anything so far.

Thank you,
Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20091113/54eacad9/attachment.html>


More information about the Ironruby-core mailing list