Total Page Preview:   000000003094

Can you declare multiple catch blocks in C#?

Yes, we can declare Multiple catch blocks but only one catch block will be executed.

Example:

       try

       {
             WebId = new Guid(queryString["web"]);
       }
       catch (FormatException)
       {
            WebId = Guid.Empty;
       }
       catch (OverflowException)
       {
           WebId = Guid.Empty;
       }

Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com



Comments

SANNY KUMAR
01-Jul-2016
Very nice article.
Brijesh Kumar
10-Sep-2016
This article is very useful for DBA.
Ajay Zara
10-Sep-2016
Really is this article is very good keep continue this type article.
Wittenoom
21-Jun-2017
Hi it's me, I am also visiting this web site on a regular basis, this web page is truly nice and the people are genuinely sharing fastidious thoughts.
Elliot
13-Nov-2019
Your style is unique compared to other folks I have read stuff from. Thanks for posting when you've got the opportunity, Guess I'll just bookmark this web site.
Bustamante
29-Jul-2021
I used to be able to find good advice from your content.