summaryrefslogtreecommitdiff
path: root/mcs/tests/test-763.cs
blob: bdb03a8a337f99f0c7739f9d2562725f1e270306 (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 class StaticDelegateWithSameNameAsInstance
{
	private Provider _provider;
	delegate void Provider (string s);

	Provider MyProvider
	{
		set
		{
			_provider = value;
			if (_provider != null) {
				_provider ("v");
			}
		}
	}

	static int i = 1;

	public void StaticCallback ()
	{
		i += 7;
		MyProvider = StaticCallback;
	}

	public static void StaticCallback (string s)
	{
		if (s != "v")
			throw new ApplicationException ();

		i *= 3;
	}

	public static int Main ()
	{
		new StaticDelegateWithSameNameAsInstance ().StaticCallback ();

		Console.WriteLine (i);
		if (i != 24)
			return 1;

		return 0;
	}
}