????Exception??????
????????Exception?????????????SystemException??ApplicationException?????????????????????????????????????????е???
???????????????Demo

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace finallyReturn
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("??????1~4????");
try
{
int num = int.Parse(Console.ReadLine());
if (num < 1 || num > 4)
throw new MyException("???????Χ??");
}
catch (MyException me)
{
Console.WriteLine(me.Message);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
finally
{
Console.WriteLine("????Finally??");
}
Console.ReadLine();
return;
}
}
class MyException : ApplicationException
{
//public MyException(){}
public MyException(string message) : base(message) { }
public override string Message
{
get
{
return base.Message;
}
}
}
}

?????????????????????MyException??ApplicationException??catch??MyException me??????????????????catch??Exception e????????????????????????????catch????????????catch????????У???????finally?е????