Total Page Preview:   000000002714

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

Laffer
11-Oct-2021
Ꭲhіs paragraph is truly a good one it helps new the web peoρle, who ɑre wishing for blogging.
Curmi
03-Aug-2021
Hmm is anyone else encountering prߋblems with the pictures on this blog ⅼ᧐adіng? I'm trying to ⅾetеrmine if its a problem on my end or іf it's the blog. Any suggestions would be greatlу appreciated.