how does break affect try .. catch... finally in C# 2003

Posted on 2007-11-19
Last Modified: 2008-02-01
In this scenario, will the break cause the finally to be skipped?

foreach (Xceed.Grid.DataRow dr in this.gcResults.DataRows)
				foreach (Xceed.Grid.DetailGrid dGrid in dr.DetailGrids)
					foreach (Xceed.Grid.DataRow drSub in dGrid.DataRows)
						if (Convert.ToBoolean(drSub.Cells[6].Value) == true)
								//expire the old record
								//insert the new record
							catch (Exception ex)
								MessageBox.Show (this,"Failure To Write Record | " + ex.Message,"Commercial Bag PA Bulk Update",MessageBoxButtons.OK,MessageBoxIcon.Warning);
								if (c.State != ConnectionState.Closed)

Open in new window

Question by:g_johnson
LVL 142

Accepted Solution

Guy Hengel [angelIII / a3] earned 350 total points
ID: 20315491
break where?

anyhow, break will only terminate the closest loop or switch, so it will only terminate that. it will NOT skip the finally.
LVL 15

Assisted Solution

Solar_Flare earned 150 total points
ID: 20315524
Finally will ALWAYS be executed, even returning a function from inside the try..catch will still execute the finally code

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In a recent question ( here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question