[Ironruby-core] delegate

Huw Collingbourne lists at ruby-forum.com
Sun Feb 3 14:48:28 EST 2008

Michael Letterle wrote:

> rbutton.Click { |sender,e| puts "Clicked!"}
> Why do you feel the need to new up an EventHandler directly?

The problem is that this does not providee the ability (as in all other 
.NET languages) to do true delegation. In C#, for example, it is 
perfectly posssible to delegate the same event handling method to large 
numbers of different controls. We have already 'faked' delegation in a 
similar way to your suggestion (attaching blocks to specific 
Control.events) in our current form designer for IronRuby:


For a production system, however, this is less than desirable. What we 
really need is the normal .NET type of delegate chaining using the += 
and -= operators.

best wishes

SapphireSteel Software
Ruby and Rails In Visual Studio
Posted via http://www.ruby-forum.com/.

More information about the Ironruby-core mailing list