public class MyException : System.Exception { } public class A { public void F() { try { } catch(MyException ex) { System.Console.WriteLine(ex.ToString()); } } } public class B { public static void Main(string[] args) { A a = new A(); a.F(); } }