C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
iOS
Java
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
10
Reply
Can multiple catch blocks be executed?
Gautam Kumar
12y
3.2k
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.
Ranjit Powar
11y
1
No, Multiple catch blocks can't be executed. Once the proper catch code executed, the control is transferred to the finally block and then the code that follows the finally block gets executed.
Gautam Kumar
12y
1
yes multiple catch is possible in c#
Ananth G
9y
0
No.Catch block that handles the exception will get executed and all other catch will be skipped and then control goes to finally block if there is any and then to subsequent code after the finally block. class A {static void Main(string[] args){try{int a = 10;int b = 0;int i = a / b;}catch (DivideByZeroException){Console.WriteLine("Inside Specialized Catch");}catch (Exception){Console.WriteLine("Inside Generalized Catch");}finally{Console.WriteLine("Inside Finally");}Console.WriteLine("Outside try/catch/finally --- I got chance to Run");} }
Sachin Kumar
10y
0
yes we have multiple catch block . just type in google "can we have multiple catch for a single try in c# " you found out your answer
suraj ghosi
10y
0
No
Pramod Verma
10y
0
Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.
Ranjit Powar
11y
0
Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.
Ranjit Powar
11y
0
Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.
Ranjit Powar
11y
0
Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.
Ranjit Powar
11y
0
What are the differences between System.String and System.Text.StringBuilder classes?
What is the difference between Finalize() and Dispose() methods?
Message