Merge pull request #495 from nicolas-raoul/fix-for-issue2907-with-no-formatting-changes
[mono.git] / mcs / tests / test-567.cs
1 using System;
2 using System.Reflection;
3 using System.Runtime.InteropServices;
4
5 namespace preservesig_test
6 {
7         class Class1
8         {
9                 public static int Main(string[] args)
10                 {
11                         MethodInfo dofoo = typeof(TestClass).GetMethod("DoFoo");
12                         if ((dofoo.GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) == 0)
13                                 return 1;
14                         
15                         dofoo = typeof(TestClass).GetProperty("Foo").GetGetMethod ();
16                         if ((dofoo.GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) == 0)
17                                 return 1;
18
19                         dofoo = typeof(TestClass).GetEvent("e").GetAddMethod (true);
20                         if ((dofoo.GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) == 0)
21                                 return 1;
22                         
23                         Console.WriteLine("Has PreserveSig");
24                         return 0;
25                 }
26         }
27
28         public class TestClass
29         {
30                 public delegate void D ();
31                 
32                 [method:PreserveSig]
33                 public event D e;
34                 
35                 [PreserveSig()]
36                 public int DoFoo()
37                 {
38                         return 0;
39                 }
40                 
41                 public int Foo {
42                         [PreserveSig]
43                         get {
44                                 return 2;
45                         }
46                 }
47         }
48 }