bring Mono Security to monotouch
[mcs.git] / tests / test-101.cs
blob5ed02f537e6e7224c8ed40e94694bb0ef8029d14
1 using System;
2 using System.Reflection;
4 namespace Test {
6 public class MyAttribute: Attribute {
7 public string val;
8 public MyAttribute (string stuff) {
9 System.Console.WriteLine (stuff);
10 val = stuff;
14 public class My2Attribute: MyAttribute {
15 public int ival;
16 public My2Attribute (string stuff, int blah) : base (stuff) {
17 System.Console.WriteLine ("ctor with int val"+stuff);
18 ival = blah;
22 [Flags, ]
23 enum X {
24 A, B
27 [My("testclass")]
28 [My2("testclass", 22)]
29 public class Test {
30 static public int Main() {
31 System.Reflection.MemberInfo info = typeof (Test);
32 object[] attributes = info.GetCustomAttributes (false);
33 for (int i = 0; i < attributes.Length; i ++) {
34 System.Console.WriteLine(attributes[i]);
36 if (attributes.Length != 2)
37 return 1;
38 MyAttribute attr = (MyAttribute) attributes [0];
39 if (attr.val != "testclass")
40 return 2;
41 return 0;