singrdk/base/Windows/csic/test/exception.cs

27 lines
522 B
C#
Raw Permalink Normal View History

2008-11-17 18:29:00 -05:00
using System;
class test {
static void F() {
try {
G();
} catch (Exception e) {
Console.WriteLine("Exception in F: " + e.Message);
e = new Exception("F");
//throw; // re-throw
throw e; // throw a new exception
} catch {
;
} finally {
Console.WriteLine("F finally block");
}
}
static void G() {
throw new Exception("G");
}
public static void Main() {
try {
F();
} catch (Exception e) {
Console.WriteLine("Exception in Main: " + e.Message);
}
}
}