2 using System.Runtime.InteropServices;
8 [DllImport ("libc", SetLastError=true)]
9 public static extern uint getuid ();
12 [DllImport ("kernel32.dll", SetLastError=true)]
13 public static extern uint GetTickCount ();
15 static bool RunningOnMono ()
17 bool mono = (Type.GetType ("Mono.Math.BigInteger") != null);
18 Console.WriteLine ("Running on {0} runtime...", mono ? "Mono" : "Microsoft");
22 // this attribute has NO effect on LinkDemand!
23 [SuppressUnmanagedCodeSecurity]
27 uint u = (RunningOnMono ()) ? getuid () : GetTickCount ();
28 Console.WriteLine ("*0* P/Invoke: {0}", u);
31 catch (SecurityException se) {
32 Console.WriteLine ("*1* Unexpected SecurityException\n{0}", se);
36 Console.WriteLine ("*2* Unexpected exception\n{0}", e);