blob: 1e0e5a6dc72a5b5eef5bc8558c5be6d5b3da3c5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
using System;
struct MyColor
{
int v;
public MyColor (int v)
{
this.v = v;
}
public static bool operator == (MyColor left, MyColor right)
{
return left.v == right.v;
}
public static bool operator != (MyColor left, MyColor right)
{
return left.v != right.v;
}
}
public class NullableColorTests
{
public static int Main ()
{
MyColor? col = null;
bool b = col == new MyColor (3);
Console.WriteLine (b);
if (b)
return 1;
b = col != new MyColor (3);
if (!b)
return 2;
return 0;
}
}
|