2010-06-17 Geoff Norton <gnorton@novell.com>
[mono.git] / mono / tests / catch-generics.2.cs
blob570552cd60f00bac609b00db49fa58f20fc49c5d
1 using System;
3 class Test<T> where T :Exception {
5 public void test_catch () {
6 try {
7 throw new RankException ();
8 } catch (T) {
13 public class Program
15 delegate void Action();
16 static void ExpectedException<T>(Action action) where T: Exception
18 try {
19 action();
20 Console.WriteLine("Expected Exception: " + typeof(T).FullName);
21 } catch (T) { }
24 public static void Main()
26 ExpectedException<DivideByZeroException>(delegate() { throw new DivideByZeroException(); });
27 Test<RankException> t = new Test<RankException> ();
28 t.test_catch ();