[Ironruby-core] Asynchronous Delegates

Bassel Samman lists at ruby-forum.com
Thu Feb 11 18:10:12 EST 2010

Thanks guys.  I ended up writing a wrapper that takes an action and runs 
it in an async delegate and that worked fine.  You can obviously get 
much fancier, but an example would be along the lines of this:

C# class:
    public class WrapInDelegate{
        public delegate void DelegateWrapper();
        public DelegateWrapper wrapper;
        public WrapInDelegate(Action a){
            wrapper = delegate(){a.Invoke();};

        public IAsyncResult  BeginInvoke(){
            return wrapper.BeginInvoke(null, null);

        public void EndInvoke(IAsyncResult result){

>From Ruby:
    d = WrapInDelegate.new(System::Action.new { puts "I run for no 
man..." })
    r = d.BeginInvoke
    d.EndInvoke r
Posted via http://www.ruby-forum.com/.

More information about the Ironruby-core mailing list