Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gtest-428.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 33e76fcd022902e25ff5dc0d4b431de58349ada7 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;

public struct CInt
{
	int data;

	public CInt (int data)
	{
		this.data = data;
	}

	public static implicit operator CInt (int xx)
	{
		return new CInt (xx);
	}

	public static implicit operator int (CInt xx)
	{
		return xx.data;
	}
}


public class Klass
{
	CInt? t;
	public Klass (CInt? t)
	{
		this.t = t;
	}

	public CInt? Value
	{
		get
		{
			return t;
		}
	}
}

public class MainClass
{
	public static int Main ()
	{
		var v = new Klass (new CInt (3));

		if (v.Value == 1)
			return 1;

		if (v.Value != 3)
			return 2;

		if (v.Value == null)
			return 3;

		var v2 = new Klass (null);

		if (v2.Value != null)
			return 4;

		Console.WriteLine ("OK");
		return 0;
	}
}