Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / catch-generics.2.cs
1 using System;
2
3 class Test<T>  where T :Exception {
4
5         public void test_catch () {
6                 try {
7                         throw new RankException ();
8                 } catch (T) {
9                 }
10         }
11 }
12
13 public class Program
14 {
15         delegate void Action();
16         static void ExpectedException<T>(Action action) where T: Exception
17         {
18                 try { 
19                         action();
20                         Console.WriteLine("Expected Exception: " + typeof(T).FullName);
21                 } catch (T) { }
22         }
23
24         public static void Main()
25         {
26                 ExpectedException<DivideByZeroException>(delegate() { throw new DivideByZeroException(); });
27                 Test<RankException> t = new Test<RankException> ();
28                 t.test_catch ();
29         }
30 }