关于TRY和CATCH块 [英] Regarding TRY and CATCH blocks
本文介绍了关于TRY和CATCH块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我已经获得了为现有代码应用TRY和CATCH块的作业。我不确定代码究竟是什么,但我已经要求这样做,代码很大。所以我只想检查如何编写TRY和CATCH块。我是新手,所以请你帮忙。 TRY / CATCH是相同的语法,无论代码如何或基于代码都会反映出来?
我尝试了什么:
请让我知道标准。
Hi All,
I have got an assignment to apply TRY and CATCH blocks for existing code. I'm not sure what exactly the code is but i ave asked to do that and the code is huge. So i just want to check how to write TRY and CATCH blocks. I'm new to this so taking your help. TRY/CATCH is same syntax, irrespective of code or based on the code will it reflect?
What I have tried:
Please let me know the criteria.
推荐答案
试试
...catch
始终是相同的语法,唯一的区别是您在catch
语句中指定的Exception类型,如果你还需要使用finally
块。
文档非常明确:try-catch(C#Reference) [ ^ ]并包含一些示例。请注意,页面左侧有四个code>尝试的形式 - 您应该阅读所有三个。
try
...catch
is always the same syntax, the only difference is the Exception type you specify in thecatch
statement, and if you need to use afinally
block as well.
The documentation is pretty clear on this: try-catch (C# Reference)[^] and includes some examples. Note that there are four "forms" oftry
on the left of the page - you should read all three.
这篇关于关于TRY和CATCH块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文