[Ironruby-core] Implementing generic interface

Arseny Sizov arseny.sizov at db.com
Tue Nov 9 03:49:08 EST 2010


Hi all,

I need to implement .NET generic interface and pass this implementation to 
.NET generic method. Is it possible in IronRuby?

What I have in .NET:

interface Subscriber {
        void Subscribe<TMessage>(IMessagesListener<TMessage> listener)   
where TMessage : IBasicMessage;
}

    public interface IMessagesListener<in TMessage>
        where TMessage : IBasicMessage
    {
        void Handle(TMessage message);
    }

I need to rewrite this code in ironruby:

class MyMessageListener <TMyMessage> : 
        IMessageListener<TMyMessage>
{
            void IMessagesListener<TMyMessage>.Handle(TMyMessage message)
            {
 
            }
}

subscriber.Subscribe<TMyMessage>(new MyMessageListener<TMyMessage>());

Is it possible?

Thanks in advance.


Best regards,
Arseny Sizov.




---

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20101109/ed819ffa/attachment.html>


More information about the Ironruby-core mailing list