📄 ex-11-03
字号:
// Example 11-03: Catch in a calling function
namespace Programming_CSharp
{
using System;
public class Test
{
public static void Main()
{
Console.WriteLine("Enter Main...");
Test t = new Test();
t.Func1();
Console.WriteLine("Exit Main...");
}
public void Func1()
{
Console.WriteLine("Enter Func1...");
try
{
Console.WriteLine("Entering try block...");
Func2();
Console.WriteLine("Exiting try block...");
}
catch
{
Console.WriteLine(
"Exception caught and handled.");
}
Console.WriteLine("Exit Func1...");
}
public void Func2()
{
Console.WriteLine("Enter Func2...");
throw new System.Exception();
Console.WriteLine("Exit Func2...");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -