projects
/
mono.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Allow passing null to JsonArray.Add()
[mono.git]
/
mcs
/
tests
/
gtest-618.cs
1
using System;
2
3
struct S1
4
{
5
public static implicit operator int (S1? s)
6
{
7
return 1;
8
}
9
}
10
11
struct S2
12
{
13
public static implicit operator int? (S2? s)
14
{
15
return null;
16
}
17
}
18
19
struct S3
20
{
21
public static implicit operator int? (S3? s)
22
{
23
return 2;
24
}
25
}
26
27
struct S4
28
{
29
public static implicit operator int? (S4 s)
30
{
31
return 3;
32
}
33
}
34
35
class C
36
{
37
public static int Main ()
38
{
39
S1? s1 = new S1 ();
40
switch (s1) {
41
case 1:
42
break;
43
default:
44
return 1;
45
}
46
47
S2? s2 = new S2 ();
48
switch (s2) {
49
case null:
50
break;
51
default:
52
return 2;
53
}
54
55
S3? s3 = new S3 ();
56
switch (s3) {
57
case 2:
58
break;
59
default:
60
return 3;
61
}
62
63
S4 s4 = new S4 ();
64
switch (s4) {
65
case 3:
66
break;
67
default:
68
return 4;
69
}
70
71
return 0;
72
}
73
}