merged Sys.Web.Services 2.0 support in my branch:
[mono.git] / mono / tests / cas / linkdemand / icall3.cs
1 using System;
2 using System.Runtime.CompilerServices;
3 using System.Security;
4
5 namespace System {
6
7         // this is a "public" internal call for both Mono and Microsoft
8         // http://groups.google.ca/groups?q=MethodImplAttribute+InternalCall&hl=en&lr=&selm=udngxsETCHA.1468%40tkmsftngp11&rnum=10
9         public class Math {
10
11                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
12                 public static extern double Sin (double a);
13         }
14 }
15
16 public class Program {
17
18         static int TestICall ()
19         {
20                 return (int) System.Math.Sin (0);
21         }
22
23         static int Main ()
24         {
25                 try {
26                         Console.WriteLine ("*0* System.Math.Sin(0) == {0}", TestICall ());
27                         return 0;
28                 }
29                 catch (SecurityException se) {
30                         Console.WriteLine ("*1* SecurityException\n{0}", se);
31                         return 1;
32                 }
33                 catch (Exception e) {
34                         Console.WriteLine ("*2* Unexpected exception\n{0}", e);
35                         return 2;
36                 }
37         }
38 }