如果错误发生在finally块之后,有没有办法处理try-catch-finally中的错误?
我只是好奇。我刚刚使用 try-catch-finally 用 C# 编写了第一个主要代码。我想知道是否存在这样一种方法来处理错误,如果在finally块内还有额外的东西需要处理。谢谢。
I was just curious. I have just written my first major code in C#, using try-catch-finally. I was wondering if there existed such a method to handle errors if there was additionally stuff to be processed after inside the finally block. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在您的finally子句中嵌套另一个try-catch块(如果我正确理解您的问题):
You could nest another try-catch block in your finally clause (if I understand your question correctly):
我对c一无所知,但逻辑告诉我,如果你在try-catch-finally之外,你就超出了该条件语句的范围,因此需要一个新的try-catch-finally或类似的东西
i know nothing about c but logic tell me if your are outside the try-catch-finally you are out of the scope of that conditional statement and therefore need a new try-catch-finally or something similar