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

gtest-111.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 847799ee504277f872f37f61827fcbc5ad3adb2f (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
using System;

public struct KeyValuePair<K,V>
{
	public K key;
	public V value;

	public KeyValuePair(K k, V v) { key = k; value = v; }

	public KeyValuePair(K k) { key = k; value = default(V); }
}

public class Collection<T>
{
	public readonly T Item;

	public Collection (T item)
	{
		this.Item = item;
	}

	public void Find (ref T item)
	{
		item = Item;
	}
}

class X
{
	static int Main ()
	{
		KeyValuePair<int,long> p = new KeyValuePair<int,long> (3);
		KeyValuePair<int,long> q = new KeyValuePair<int,long> (5, 9);

		Collection<KeyValuePair<int,long>> c = new Collection<KeyValuePair<int,long>> (q);
		c.Find (ref p);

		if (p.key != 5)
			return 1;
		if (p.value != 9)
			return 2;

		return 0;
	}
}