在C#中异常是用try...catch...finally...表示的。
另外它可以存在几个,存在异常的管辖范围问题,根据大小来定义。
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication7
{
        class Program
        {
                static void Main(string[] args)
                {
                        try
                        {
                                int i = 1;
                                int j = 0;
                                Console.WriteLine(i / j);
                        }
                        catch(DivideByZeroException dze)
                        {
                                Console.WriteLine(dze.Message);
                        }
                        catch(Exception e)
                        {
                                Console.WriteLine("Error:"+e.Message);
                        }
                        finally
                        {
                                Console.WriteLine("Over");
                        }
                        
                }
        }
}
上例中他就会只报第一个错,不会出现第二个的“Error:”的错误提示。
但是如果你这样写的话:
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication7
{
        class Program
        {
                static void Main(string[] args)
                {
                        try
                        {
                                int i = 1;
                                int j = 0;
                                Console.WriteLine(i / j);
                        }
                        catch(Exception e)
                        {
                                Console.WriteLine("Error:"+e.Message);
                        }
                        catch (DivideByZeroException dze)
                        {
                                Console.WriteLine(dze.Message);
                        }
                        finally
                        {
                                Console.WriteLine("Over");
                        }
                        
                }
        }
}
它就会提示你:上一个Catch字句已经捕获了此类型或超此类型的的所有异常。
 
另外在DelphI中的异常捕获也有相似的语句:
try    
     语句
except
        on e: Exception do
            Application.MessageBox('数据刷新错误!', '错误', MB_OK + MB_ICONSTOP);
end;