惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
小众软件
小众软件
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
L
LangChain Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
Docker
Cyberwarzone
Cyberwarzone
腾讯CDC
V
Vulnerabilities – Threatpost
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
AWS News Blog
AWS News Blog
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
MyScale Blog
MyScale Blog
C
CERT Recently Published Vulnerability Notes
T
Threat Research - Cisco Blogs
S
Securelist
C
Cybersecurity and Infrastructure Security Agency CISA
Security Archives - TechRepublic
Security Archives - TechRepublic
Know Your Adversary
Know Your Adversary
Security Latest
Security Latest
N
News and Events Feed by Topic
Attack and Defense Labs
Attack and Defense Labs
V
Visual Studio Blog
博客园 - 司徒正美
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
I
Intezer
P
Privacy International News Feed
爱范儿
爱范儿
T
The Exploit Database - CXSecurity.com
O
OpenAI News
云风的 BLOG
云风的 BLOG
博客园_首页
雷峰网
雷峰网
M
MIT News - Artificial intelligence
Project Zero
Project Zero
I
InfoQ
Hacker News: Ask HN
Hacker News: Ask HN
C
Cyber Attacks, Cyber Crime and Cyber Security
N
News and Events Feed by Topic
S
Security Affairs
S
Secure Thoughts
Y
Y Combinator Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
美团技术团队
The GitHub Blog
The GitHub Blog
B
Blog
H
Hacker News: Front Page

博客园 - pot

在框架中(IFRAME/FRAMESET)传递COOKIE的解决方案[转] jQuery图片播放插件Fancybox使用方法 C#生成缩略图代码 数据抓取的一个类,包含一些常用的方法 抓取AJAX网页的方法-Firefox组件,C#集成 C#编号的ActiveX控件采用CAB的布署方式实例 C#编写ActiveX控件实例(包括命令和事件) PdfAcroViewer C#代码登录活动目录 用XML反序列化快速完成ASP.NET配置文件 - pot - 博客园 android Activity类的使用 Android中的Intent详细讲解 Android模拟器常用使用,和基本功能使用 ZPL II 命令参考 正则表达式语法 - pot - 博客园 C#中接口的作用 The RSA key container could not be opened - pot ASP.NET 页面事件执行顺序 关于object sender,EventArgs e 的一些解释
《C#异常处理》
pot · 2008-04-12 · via 博客园 - pot

1、c#中所有的异常处理都被视为,所有异常都是由System.Exception所派生的。

2、C#中处理错误异常管理的关键字指令有四个:try、catch、throw、finally,有这四个关键字所编写的异常处理功能非常的强大与方便。

3、异常处理的语法:try{有可能产生错误的代码}catch(异常处理声明(声明此catch区段要捕获哪一种类型的异常错误,可以不用声明,这样子便会让catch去捕获任意类型的异常错误)){异常处理程序代码(当catch捕获到异常错误后,所采取对应的程序代码)}注意:利用catch来捕获try-catch中产生的异常错误,可以建立多个catch区段以捕获不同类型的异常错误。

3C#中常见异常类:

说明

OutOfMemoryException

当利用new关键字去初始化分配一块内存失败时

StackOverflowException

当执行程序有利用到堆栈资源时(通常是执行Recursion或太多的循环),将堆栈资源耗尽时

NullReferenceException

当要利用Reference对象时,却是NullReference

TypeInitializationException

若静态对象发生错误,但又缺乏catch区段去处理与对应时

ArrayTypeMismatchException

当存入数据与数组中数据类型不同时

IndexOutOfRangeException

当超过数组的限定范围时

MulticastNotSupportedException

当要合并两个委派对象失败时

ArithmeticException

一般在运算失败时,这包含了DivideByzeroExceptionOverflowException两种异常

DivideByzeroException

当使用除法运算时,分母为0所造成的错误时

OverflowException

当运算后超过数据类型的合法范围时

posted @ 2008-04-12 18:15  pot  阅读(3537)  评论()    收藏  举报