15 public readonly IrishBeer Beer
;
17 public IrishPub (IrishBeer beer
)
22 public static implicit operator long (IrishPub
? pub
)
24 return pub
.HasValue
? (long) pub
.Value
.Beer
: 0;
27 public static implicit operator IrishPub
? (long value)
29 return new IrishPub ((IrishBeer
) value);
35 static int Beer (IrishPub
? pub
)
49 static long PubToLong (IrishPub pub
)
54 static int Test (int? a
)
68 static int TestWithNull (int? a
)
85 static long? Foo (bool flag
)
93 static int Test (bool flag
)
107 public static int Main ()
109 IrishPub pub
= new IrishPub (IrishBeer
.Guinness
);
110 if (PubToLong (pub
) != 0x1001)
113 if (Beer (null) != 3)
115 if (Beer (new IrishPub (IrishBeer
.Guinness
)) != 1)
118 if (Test (null) != 2)
122 if (Test (true) != 1)
124 if (Test (false) != 2)
127 if (TestWithNull (null) != 2)
129 if (TestWithNull (3) != 1)