2 using System
.Reflection
;
5 // Test the setting for the default public constructor
7 abstract class Abstract
{
11 // Test the setting for the default public consturctor
18 static protected internal void MyProtectedInternal () { }
19 static internal void MyInternal() { }
20 static public void MyPublic () { }
21 static void MyPrivate () {}
23 public static int Main ()
25 Type myself
= typeof (Test
);
26 BindingFlags bf
= BindingFlags
.Static
| BindingFlags
.NonPublic
| BindingFlags
.Public
;
27 MethodAttributes mpia
;
33 mpi
= myself
.GetMethod ("MyProtectedInternal", bf
);
34 mpia
= mpi
.Attributes
& MethodAttributes
.MemberAccessMask
;
35 if (mpia
!= MethodAttributes
.FamORAssem
)
41 mpi
= myself
.GetMethod ("MyInternal", bf
);
42 mpia
= mpi
.Attributes
& MethodAttributes
.MemberAccessMask
;
43 if (mpia
!= MethodAttributes
.Assembly
)
49 mpi
= myself
.GetMethod ("MyPublic", bf
);
50 mpia
= mpi
.Attributes
& MethodAttributes
.MemberAccessMask
;
51 if (mpia
!= MethodAttributes
.Public
)
57 mpi
= myself
.GetMethod ("MyPrivate", bf
);
58 mpia
= mpi
.Attributes
& MethodAttributes
.MemberAccessMask
;
59 if (mpia
!= MethodAttributes
.Private
)
63 // Test 17.10.4 accessibility (default constructor permissions)
65 ConstructorInfo ci
= typeof (Abstract
).GetConstructor
66 (BindingFlags
.Public
| BindingFlags
.NonPublic
| BindingFlags
.Instance
, null, new Type
[0], new
67 ParameterModifier
[0]);
72 ci
= typeof (Plain
).GetConstructor
73 (BindingFlags
.Public
| BindingFlags
.NonPublic
| BindingFlags
.Instance
, null, new Type
[0], new
74 ParameterModifier
[0]);
79 Console
.WriteLine ("All tests pass");