2 using System
.Linq
.Expressions
;
4 namespace TestGenericsSubtypeMatching
6 public class Sender
<T
> : IDisposable
9 public void DoSend
<TMessage
> (Action
<T
> action
)
11 using (Sender
<T
> sub
= new Sender
<T
> ())
16 sub
.ActionOnObject (t
);
21 private static void Send (Action
<T
> action
)
25 void ActionOnObject (object o
)
30 #region IDisposable implementation
31 public void Dispose ()
33 Console
.WriteLine ("Dispose!");
41 public static int Main ()
43 new Sender
<int> ().DoSend
<bool> (l
=> Console
.WriteLine (l
));