📄 processexception.cs
字号:
using System;
using System.IO;
public class ProcessException
{
public static void Main()
{
StreamWriter sw = null;
try
{
sw = new StreamWriter(new FileStream("Test.txt",FileMode.Open));
sw.WriteLine("Hello there");
Console.WriteLine("Message is written into file Test.txt");
}
catch(FileNotFoundException fnfe)
{
Console.WriteLine("File "+fnfe.FileName+" not found");
}
catch(Exception e)
{
Console.WriteLine(e);
}
finally
{
if (sw!=null)
{
sw.Close();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -