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

test-860.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a87e624db781f0607ec9651fde7fcac6fbe215ac (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 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 sealed class SomeAttribute : Attribute
	{
		public SomeAttribute (string someText)
		{
		}
	}
}