Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / dtest-optional-01.cs
1 using System;
2 using System.Reflection;
3 using System.Runtime.InteropServices;
4
5 struct S
6 {
7 }
8
9 public class G<T>
10 {
11
12         public object M1 (T o = default (T))
13         {
14                 return o;
15         }
16
17         public object M2 ([Optional] T o)
18         {
19                 return o;
20         }
21 }
22
23 public class C
24 {
25         public static object Test ([Optional] dynamic a)
26         {
27                 return a;
28         }
29         
30         void TestS (S s = default (S))
31         {
32         }
33         
34         object TestD (dynamic o = null)
35         {
36                 return o;
37         }
38
39         public static int Main ()
40         {
41                 if (Test () != Missing.Value)
42                         return 1;
43                 
44                 dynamic d = new C ();
45                 d.TestS ();
46                 
47                 if (d.TestD () != null)
48                         return 2;
49                         
50                 d = new G<string> ();
51                 if (d.M1 () != null)
52                         return 3;
53                         
54                 if (d.M2 () != null)
55                         return 4;
56                 
57                 return 0;
58         }
59 }