如果
#26是异常,则可以使用
AppDomain.CurrentDomain.UnhandledException事件。如果这只是一个返回值,那么我看不到有任何全局处理该值的机会。
public static void Main(){ AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler); // start main thread here}static void MyHandler(object sender, UnhandledExceptionEventArgs args) { Exception e = (Exception) args.ExceptionObject; Console.WriteLine("MyHandler caught : " + e.Message);}


