Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

32 lines
740 B
C#

using System;
using System.Reflection;
[AttributeUsage(AttributeTargets.Field)]
public class AccessibleAttribute:Attribute {}
public class MyClass
{
[Accessible]
public const int MyConst = 1;
}
public class Test
{
public static int Main()
{
FieldInfo fieldInfo = typeof(MyClass).GetField("MyConst",
BindingFlags.Static | BindingFlags.Public);
AccessibleAttribute[] attributes =
fieldInfo.GetCustomAttributes(
typeof(AccessibleAttribute), true) as AccessibleAttribute[];
if (attributes != null)
{
Console.WriteLine ("Succeeded");
return 0;
}
return 1;
}
}