summaryrefslogtreecommitdiff
path: root/mcs/tests/gtest-exmethod-01.cs
blob: a82cadcc16850b3148566cbb2304d0fb6f2e090d (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


using System;

static class SimpleTest
{
	public static string Prefix (this string s, string prefix)
	{
		return prefix + s;
	}
}

public class M
{
	public static int Main ()
	{
		SimpleTest.Prefix ("foo", "1");
		string s = "foo".Prefix ("1");
		
		Type ex_attr = typeof (System.Runtime.CompilerServices.ExtensionAttribute);
		if (!typeof (SimpleTest).IsDefined (ex_attr, false))
			return 1;
		
		if (!typeof (SimpleTest).Assembly.IsDefined (ex_attr, false))
			return 2;

		if (!typeof (SimpleTest).GetMethod ("Prefix").IsDefined (ex_attr, false))
			return 3;

		if (s != "1foo")
			return 9;
		
		Console.WriteLine (s);
		return 0;
	}
}