[Ironruby-core] Overriding CLS Virtuals

Michael Letterle michael.letterle at gmail.com
Fri Oct 24 21:20:34 EDT 2008


Do it. :)

On Fri, Oct 24, 2008 at 8:54 PM, Curt Hagenlocher <curth at microsoft.com>wrote:

>  We're thinking now that we're going to go with the mangled version of the
> name instead of the originally cased-version.  "Dispose" just doesn't look
> Rubyish enough.  Any objections?
>
>
>
> *From:* Curt Hagenlocher
> *Sent:* Monday, September 08, 2008 9:22 PM
> *To:* 'ironruby-core at rubyforge.org'
> *Subject:* Overriding CLS Virtuals
>
>
>
> I've committed some changes to IronRuby (in SVN revision 141) that let you
> implement CLS interfaces and override virtual methods on CLS base types.
> Interfaces work like Ruby modules, so to make your class implement
> IDisposable you could say
>
>
>
> require 'mscorlib'
>
> class Disposable
>
>   include System.IDisposable
>
>   def Dispose
>
>     # Do something
>
>   end
>
> end
>
>
>
> You can also override virtual properties.  A class or interface that has
> the C# declaration "string Value { get; set; }" is overridden from IronRuby
> with methods named "Value" for the getter and "Value=" for the setter.
>
>
>
> Note that you need to use the same casing as the CLS definition for both
> methods and properties.
>
>
>
> We're just getting started with better .NET interop support and don't have
> very much test coverage yet – but this should let you get going on some more
> sophisticated interop scenarios than were previously possible.
>
>
>
> --
>
> Curt Hagenlocher
>
> curth at microsoft.com
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>


-- 
Michael Letterle
[Polymath Prokrammer]
http://blog.prokrams.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20081024/6884e613/attachment.html>


More information about the Ironruby-core mailing list