2 using System
.Reflection
;
3 using System
.Reflection
.Emit
;
5 public class MyException
: Exception
{
10 public static int Main()
12 DynamicMethod method_builder
= new DynamicMethod ("ThrowException" , typeof (void), new Type
[0], typeof (Driver
));
13 ILGenerator ilg
= method_builder
.GetILGenerator ();
16 ilg
.Emit (OpCodes
.Newobj
, typeof (MyException
).GetConstructor (new Type
[0]));
17 ilg
.Emit (OpCodes
.Throw
);
20 method_builder
.Invoke (null, null);
22 } catch (TargetInvocationException tie
) {
23 if(! (tie
.InnerException
is MyException
))