Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-null-operator-03.cs
1 using System;
2
3 class C
4 {
5     int field;
6
7     int Test1 ()
8     {
9         var x = this?.field;
10         if (x == null)
11             return 1;
12
13         var x2 = "abc"?.GetHashCode();
14         if (x2 == null)
15             return 2;
16
17         return 0;
18     }
19
20     static int Main ()
21     {
22         var c = new C ();
23         c.Test1 ();
24
25         const C c2 = null;
26         var res = c2?.field;
27         if (res != null)
28             return 1;
29
30         Console.WriteLine ("ok");
31         return 0;
32     }
33 }