[corlib] Fix a few NSLogWriter issues. (#13799)
[mono-project.git] / mcs / tests / gtest-539.cs
blobe040a42860a3e657e7fd120052cca2c0ea8ac05b
1 using System;
3 struct S
5 public int ID { get; set; }
8 class C
10 public readonly int ID;
12 private C (int id)
14 ID = id;
17 public static explicit operator C (S x)
19 throw new ApplicationException ("wrong conversion");
22 public static explicit operator C (S? x)
24 return new C (x.HasValue ? x.Value.ID : 5);
28 public class Test
30 public static int Main ()
32 S? s = null;
33 C c = (C) s;
35 if (c.ID != 5)
36 return 1;
38 s = new S () { ID = 10 };
39 c = (C) s;
41 if (c.ID != 10)
42 return 2;
44 return 0;