C#3.5牢固掌握C#基础.pptVIP

  • 8
  • 0
  • 约9.85万字
  • 约 419页
  • 2015-07-23 发布于广东
  • 举报
12.1.3 自定义异常处理类 throw使用示例: static void Main(string[] args) { try {……. if(ia.Length) throw new IndexOutOfRangeException(); a[i]=int.Parse(Console.Readline()); } catch(System.IndexOutOfRangeException e) { //数组越界异常 } } 12.1.3 自定义异常处理类 自定义异常类使用示例: class EmailException : Exception { string errorname; //出错人姓名 string errmsg; //错误信息 public EmailException(string msg, string name): base(msg) //构造函数 { errorname = name; errordate = DateTime.Now.ToString(); errormsg=msg; } public void SendToMail() { Console.Write

文档评论(0)

1亿VIP精品文档

相关文档