2 using System.Reflection;
3 using System.Runtime.InteropServices;
4 using System.Runtime.CompilerServices;
6 namespace preservesig_test
10 static int Main(string[] args)
12 MethodInfo dofoo = typeof(TestClass).GetMethod("DoFoo");
13 if ((dofoo.GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) == 0)
16 dofoo = typeof(TestClass).GetProperty("Foo").GetGetMethod ();
17 if ((dofoo.GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) == 0)
20 dofoo = typeof(TestClass).GetEvent("e").GetAddMethod (true);
21 if ((dofoo.GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) == 0)
24 Console.WriteLine("Has PreserveSig");
29 public class TestClass
31 public delegate void D ();
37 [MethodImpl(MethodImplOptions.InternalCall,MethodCodeType=MethodCodeType.Runtime)]