Initial set of Ward sgen annotations (#5705)
[mono.git] / mcs / tests / test-anon-123.cs
1 // Cloning tests
2
3 using System;
4 using System.Collections.Generic;
5
6 class MemberAccessData
7 {
8         public volatile uint VolatileValue;
9         public string [] StringValues;
10         public List<string> ListValues;
11         
12         int? mt;
13         public int? MyTypeProperty {
14                 set     {
15                         mt = value;
16                 }
17                 get {
18                         return mt;
19                 }
20         }
21 }
22
23 enum E
24 {
25         E1,
26         E2,
27         E3
28 }
29
30 public class B
31 {
32         protected virtual void BaseM ()
33         {
34         }
35 }
36
37 public class C : B
38 {
39         delegate void D ();
40         
41         static void Test (D d)
42         {
43         }
44         
45         static void Test (Action<E> func)
46         {
47                 func (E.E1);
48         }
49         
50         void InstanceTests ()
51         {
52                 Test (() => base.BaseM ());
53         }
54         
55         public static void Main ()
56         {
57                 Exception diffException;
58                 
59                 Test (() => {
60                         diffException = null;
61                                         try {
62                                         } catch (Exception ex) {
63                                                 diffException = ex;
64                                         } finally {
65                                         }
66                                         
67                                         try {
68                                         } catch {
69                                         }
70                                 });
71                                 
72                 int[] i_a = new int [] { 1,2,3 };
73                 
74                 Test (() => {
75                                 foreach (int t in i_a) {
76                                 }
77                         });
78                         
79                 Test (() => {
80                         Console.WriteLine (typeof (void));
81                 });
82                 
83                 Test (() => {
84                         Console.WriteLine (typeof (Func<,>));
85                 });
86                 
87                 Test (() => {
88                         object o = new List<object> { "Hello", "", null, "World", 5 };
89                 });
90                 
91                 Test (() => {
92                         var v = new MemberAccessData { 
93                                 VolatileValue = 2, StringValues = new string [] { "sv" }, MyTypeProperty = null
94                         };
95                 });
96                 
97                 Test (x => {
98                         switch (x) {
99                         case E.E1:
100                                 goto case E.E2;
101                         case E.E2:
102                                 break;
103                         default:
104                                 break;
105                         }
106                 });             
107                 
108                 var c = new C ();
109                 c.InstanceTests ();
110         }
111 }