summaryrefslogtreecommitdiff
path: root/mcs/tests/dtest-error-02.cs
blob: b8b4eb0dcd4072a482feeed8f5915008c1c21aae (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
using System;
using Microsoft.CSharp.RuntimeBinder;

class A
{
	private class N
	{
		public void Foo ()
		{
		}
	}
	
	public static dynamic Factory ()
	{
		return new N ();
	}
}

public class Test
{
	public static int Main ()
	{
		dynamic d = A.Factory ();
		
		try {
			d.Foo ();
			return 1;
		} catch (RuntimeBinderException e) {
			if (e.Message != "`A.N.Foo()' is inaccessible due to its protection level")
				return 2;
		}
		
		return 0;
	}
}