当一段code中有两个exception抛出来的时候

2014-11-24 09:55:00 · 作者: · 浏览: 0

先抛出来的那个就丢了。

 try
            {
                try
                {
                    try
                    {
                        int i = 2;
                        if (i > 1)
                            throw new AException("AException");
                    }
                    finally
                    {
                        throw new BException("BException");
                    }
                }
                catch (BException e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            catch (AException e)
            {
                Console.WriteLine( e.Message);
            }


最后结果只有一个 Bexception.