C#中的异常处理 [英] Exception Handling In C#

查看:74
本文介绍了C#中的异常处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

面试官问我1个qstn

有一组过程A,B,C

A calsB

B Cals C

A和B中有异常处理程序,但C中没有异常处理程序

然后将发生什么???????????????????????????????????????????
谢谢,
Ambesha


如果C中引发了异常,那么只要try ... catch块包围了对C的调用,它将被B捕获.再次假设try ... catch块包围了对B的调用,它将被捕获到A中.


interviewer ask me 1 qstn

there is set of Process A,B,C

A cals B

B Cals C

in A And B there is Exception Handleler But Not in C

Then What Will Happen????

解决方案

Then parent process catch will handle the exceptions in this case ''B''.

Thanks,
Ambesha


If the exception is thrown in C, then it will be caught in B, provided the try...catch block surrounds the call to C. If not, then it will be caught in A, again assuming the try...catch block surrounds the call to B.


这篇关于C#中的异常处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆