You are my hero :-)

Curt Hagenlocher wrote:

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

[EMAIL PROTECTED]


_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core

--


 Orion Edwards  
Web Application Developer

T: +64 7 859 2120
F: +64 7 859 2320
E: [EMAIL PROTECTED]

Open2view.com
The Real Estate Website

_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to