浅谈C#程序中的异常处理机制.pdfVIP

  • 9
  • 0
  • 约 3页
  • 2017-08-26 发布于河南
  • 举报
=!l一 ==jIⅢ 啦=!Ij.:!巨o=】I 浅谈C#程序中的异常处理机制 唐 瑁 (山东中医药高等专科学校,山东 烟 台264100) 摘 要:程序设计中,异常是一个不可忽略的元素,因此,有效的异常处理是程序完善的重要标志。重点介绍 了C#语言中的 异常处理机制。主要包括异常的基础知识、异常处理机制、程序设计中的异常三个部分。异常基础知识部分,讲解了什么是 异常,异常发生的情况及主要的异常类,使读者对程序异常有基本的认识。异常处理机制部分,从应用程序和理论两方面对 c#语言中对异常的处理机制进行讲解 ,详细分析了三种异常处理语句。程序设计中的异常部分,通过一个简单的程序开发中 的例子扩展异常机制在程序设计中的应用,拓宽软件开发人 员的设计思路。 关键词:程序设计;c#;异常处理 TheMechanismofHandlingExceptioninC# Program TANG Jun (SkdndongCollegeoYTradlTibnalChn/eseMed/c)/Te,Yanta,,Skandong26520O,china) Abstract:In the program designing. an exception istheelementthat is not neglected. so theeffective exception handling isthe important signwhichmakestheprogram perfect.Thisarticlefocusesonthe exceptionhandlingmechanism onC# language.Itmainly includesthethree parts,thebasicknowledgeofexception,exceptionhandling mechanism andtheexceptioninprogramming.Inthebasicknowledgepartofexception, itexplainswhat istheexception.thecondition exception occurredand themain exception class. t『make readerhavethebasicunderstanding of exception.Inthepartofexceptionhandlingmechanism,itexplainstheexceptionhandling mechanism ofC# from theapplicationandtheoretical aspects, and analysesthreeexceptionhandling statementindetail. In the part of program designing exception, it expandsexceptionhandling mechanism inthe program designing application with a simple and developped example application to expand the thinking in the development of 能发生的各类不可预期的情况,比如用户输入错误、内 自身的 存不够、磁盘 出错、网络资源不可用、数据库无法使用 在竞争 等,所有这些错误被称作异常,不能因为这些异常使程 的手工 序运行产生问题。 高 ,但 异常的发生有两种可能: 员提出 (1)代码执行过程 中满足了异常的条件而使程序无法

文档评论(0)

1亿VIP精品文档

相关文档