New tests.
[mono.git] / mcs / tests / gtest-anon-59.cs
1 using System;
2
3 namespace TestGenericsSubtypeMatching
4 {
5         public class Sender<T> : IDisposable
6         {
7                 public void DoSend<TMessage> (Action<T> action)
8                 {
9                         using (Sender<T> sub = new Sender<T> ())
10                         {
11                                 Send (t =>
12                                 {
13                                         action(t);
14                                         sub.ActionOnObject (t);
15                                 });
16                         }
17                 }
18                 
19                 private static void Send (Action<T> action)
20                 {
21                 }
22                 
23                 void ActionOnObject (object o)
24                 {
25                         o.ToString ();
26                 }
27         
28                 #region IDisposable implementation
29                 public void Dispose ()
30                 {
31                         Console.WriteLine ("Dispose!");
32                 }
33                 
34                 #endregion
35         }
36         
37         public class C
38         {
39                 public static void Main ()
40                 {
41                         new Sender<string> ().DoSend<bool>(l => Console.WriteLine (l));
42                 }
43         }
44 }