Total Page Preview:   000000001277

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