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

test-253.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d4f0096b9ba5a9ca33b50649e613b9b249d55156 (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
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;        
    } 
}