3 namespace TestGenericsSubtypeMatching
5 public class Sender
<T
> : IDisposable
7 public void DoSend
<TMessage
> (Action
<T
> action
)
9 using (Sender
<T
> sub
= new Sender
<T
> ())
14 sub
.ActionOnObject (t
);
19 private static void Send (Action
<T
> action
)
23 void ActionOnObject (object o
)
28 #region IDisposable implementation
29 public void Dispose ()
31 Console
.WriteLine ("Dispose!");
39 public static void Main ()
41 new Sender
<string> ().DoSend
<bool>(l
=> Console
.WriteLine (l
));