保持快乐,善于表达,敢于创新

c# exception.

上一篇 / 下一篇  2008-02-21 17:10:37 / 个人分类:c#

using System;
class Excep
{
 static void F(){
 try{
 G();
 }
 catch(Exception e){
 Console.WriteLine("Exception in F():{0}", e.Message); //显示e的内容是G
 e=new Exception("F");
 throw e;   // 抛出重新赋值的e.
 }
}
 static void G(){
 throw new Exception("G");
 
 
 
 }
 static void Main(){
 try{
 F();
 }
 catch(Exception e){
 Console.WriteLine("Exception in Main:{0}",e.Message);  //显示e的内容是F
 
 }
 
 
 }
 

 

 

}


TAG:

 

评分:0

我来说两句

Open Toolbar