Exception Translation
using System;
using System.Reflection;
public class MyClass {
public static void MethodA() {
Console.WriteLine("MyClass.MethodA");
throw new Exception("MethodA exception");
}
}
public class Starter {
public static void Main() {
try {
Type zType = typeof(MyClass);
MethodInfo method = zType.GetMethod("MethodA");
method.Invoke(null, null);
} catch (Exception except) {
Console.WriteLine(except.Message);
Console.WriteLine("original: " + except.InnerException.Message);
}
}
}
|
HTML code for linking to this page:
Related in same category :
-
-
|