Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / gtest-116.cs
1 using System;
2
3 namespace Slow
4 {
5         public interface ITest
6         {
7                 void DoNothing<T>()
8                         where T : class;
9         }
10
11         public class Test : ITest
12         {
13                 public void DoNothing<T>()
14                         where T : class
15                 {
16                         T x = null;
17                 }
18         }
19
20         class Program
21         {
22                 public static void Main(string[] args)
23                 {
24                         const int iterations = 10000;
25
26                         Test test = new Test ();
27             
28                         DateTime start = DateTime.Now;
29                         Console.Write ("Calling Test.DoNothing<Program>() on an object reference...  ");
30                         for (int i = 0; i < iterations; ++i)
31                         {
32                                 test.DoNothing<Program> ();
33                         }
34                         DateTime end = DateTime.Now;
35                         TimeSpan duration = end - start;
36                         Console.WriteLine ("Took " + duration.TotalMilliseconds + " ms.");
37             
38                         ITest testInterface = test;
39
40                         start = DateTime.Now;
41                         Console.Write ("Calling Test.DoNothing<Program>() on an interface reference...  ");
42                         for (int i = 0; i < iterations; ++i)
43                         {
44                                 testInterface.DoNothing<Program> ();
45                         }
46                         end = DateTime.Now;
47                         duration = end - start;
48                         Console.WriteLine ("Took " + duration.TotalMilliseconds + " ms.");
49                 }
50         }
51 }