using System;
// 例外クラスを定義
class CustomException:Exception
{
public CustomException(string message):base(message)
{
}
}
class MainClass
{
static void Main()
{
try
{
// 例外をthrow
throw new CustomException("例外をthrow");
}
catch (CustomException error)
{
// 出力値:例外をthrow
Console.WriteLine(error.Message);
}
finally
{
Console.WriteLine("終了");
}
}
}
0 コメント:
コメントを投稿