using System;
void ThrowIfTrue(bool param) {
try {
if (param) {
throw new Exception("test exception");
}
}
catch{
Console.WriteLine("catch");
}
finally {
Console.WriteLine("finally");
}
}
ThrowIfTrue(true);
//输出 "catch" 和 "finally"
ThrowIfTrue(false);
//只输出 "finally"
Console.ReadLine();