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

test-942.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e851f8b3f4ae9977726b76858195c7f789854d61 (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
using System;
using System.Reflection;
using System.Diagnostics;

namespace ConditionalAttributeTesting
{
	class MainClass
	{
		public static int Main ()
		{
			return HelloWorld ();
		}

		[Some ("Test")]
		public static int HelloWorld ()
		{
			var methodInfo = MethodBase.GetCurrentMethod ();
			SomeAttribute someAttribute = Attribute.GetCustomAttribute (methodInfo, typeof (SomeAttribute)) as SomeAttribute;
			if (someAttribute != null) {
				return 1;
			}

			return 0;
		}
	}

	[AttributeUsage (AttributeTargets.All)]
	[Conditional ("NOT_DEFINED")]
	public abstract class BaseAttribute : Attribute
	{
	}

	public class SomeAttribute : BaseAttribute
	{
		public SomeAttribute (string someText)
		{
		}
	}
}