2010-05-31 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / gtest-116.cs
blob4fe091b2b6fa7291e571ad3713c73a91a99bd459
1 using System;
3 namespace Slow
5 public interface ITest
7 void DoNothing<T>()
8 where T : class;
11 public class Test : ITest
13 public void DoNothing<T>()
14 where T : class
16 T x = null;
20 class Program
22 static void Main(string[] args)
24 const int iterations = 10000;
26 Test test = new Test ();
28 DateTime start = DateTime.Now;
29 Console.Write ("Calling Test.DoNothing<Program>() on an object reference... ");
30 for (int i = 0; i < iterations; ++i)
32 test.DoNothing<Program> ();
34 DateTime end = DateTime.Now;
35 TimeSpan duration = end - start;
36 Console.WriteLine ("Took " + duration.TotalMilliseconds + " ms.");
38 ITest testInterface = test;
40 start = DateTime.Now;
41 Console.Write ("Calling Test.DoNothing<Program>() on an interface reference... ");
42 for (int i = 0; i < iterations; ++i)
44 testInterface.DoNothing<Program> ();
46 end = DateTime.Now;
47 duration = end - start;
48 Console.WriteLine ("Took " + duration.TotalMilliseconds + " ms.");