我们可以使用多重捕获吗? [英] Can we use multiple catch ?

查看:112
本文介绍了我们可以使用多重捕获吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以在ASP.NET中使用多个catch(一个catch另一个捕获)吗?

解决方案

尝试 { // 一些代码 } 捕获 { 尝试 { // 一些代码 } 捕获 { // 一些代码 } }


基本上,asp.net不是一种语言.您实际上没有提到该语言.我认为,您不能使用您所说的话,您可以或多或少地在一个捕获中使用一个新的try捕获,或者可以在一个try下使用多个捕获,但不能在另一个捕获中使用一个捕获.
首先阅读这篇出色的文章以使事情变得清晰起来:
使用Try ... Catch ...,最后! [ C#,Vb.net多次尝试的多次catch语句 [ ^ ]

Can we use multiple catch(One catch inside another catch) in ASP.NET?

解决方案

Quote:

Can we use multiple catch(One catch inside another catch) in ASP.NET?


As Ridoy said, ASP.NET isn''t really a language. If you mean a try-catch inside a catch block inside the code-behind, then yes, it''s possible, you can use nested try-catch blocks:

try
{
    // some code
}
catch
{
    try
    {
        // some code
    }
    catch
    {
        // some code
    }
}


Basically asp.net is not a language.You not mentioned the language actually.In my opinion, no you can''t use that what you are talking about,more or less you can use a new try catch inside a catch or can use multiple catch under a try,but not a catch inside another catch.
Read this excellent article first to clear things up:
Using Try... Catch..., Finally![^]
Also can view:
C#, Vb.net multiple catch statement with single try[^]


这篇关于我们可以使用多重捕获吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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