具有异常过滤器的C#等同于"EXCEPTION_CONTINUE_EXECUTION" [英] C# equivalent of “EXCEPTION_CONTINUE_EXECUTION” with exception filter

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

问题描述

大家好,

是否有可能使用C#对过滤器函数进行一些异常处理并像C ++一样在发生异常的地方继续执行?

Is it possible that using C# to do some exception handling with filter function and continue execution at the point where the exception occurred like C++ does?

谢谢

推荐答案

不,抛出异常,然后在调用堆栈中向上移动,直到某些代码捕获到异常为止.如果根本没有捕获到异常,则您的应用程序将退出,并显示Unhandled Exception故障.因此,您唯一可以做的就是尝试捕获您希望引发异常并处理该异常的代码(换句话说,让用户知道发生了一件不好的事情,或者修复数据然后重试,诸如此类) ).

No, exceptions are thrown and walk up the call stack to until some code catches the exception. If the exception is not caught at all, your application will exit with an Unhandled Exception failure. So, the only thing you can do is put a try catch around the code that you expect to throw exceptions and handle that exception (in other words, let the user know a bad thing happened, or fix the data and try again or something like that).


这篇关于具有异常过滤器的C#等同于"EXCEPTION_CONTINUE_EXECUTION"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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