blob: cfe9e41317be06902c485fde461e808bccb24cd1 (
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
|
using System;
using System.Reflection;
public interface I
{
void Clear ();
}
public class C : I
{
public void Clear () { }
void I.Clear () { }
public static int Main ()
{
var m1 = typeof (C).GetMethod ("Clear");
Console.WriteLine (m1.Attributes);
if (m1.Attributes != (MethodAttributes.Public | MethodAttributes.HideBySig))
return 1;
var m2 = typeof (C).GetMethod ("I.Clear", BindingFlags.NonPublic | BindingFlags.Instance);
Console.WriteLine (m2.Attributes);
if (m2.Attributes != (MethodAttributes.Private | MethodAttributes.HideBySig | MethodAttributes.Final | MethodAttributes.Virtual | MethodAttributes.VtableLayoutMask))
return 2;
return 0;
}
}
|