I just found in a project:
try
{
myLabel.Text = school.SchoolName;
}
catch
{
myPanel.Visible = false;
}
I want to talk to the devel
Throwing exceptions does have a negative impact on performance, see http://msdn.microsoft.com/en-us/library/ms229009(VS.80).aspx
You are absolutely right that this is bad. It is bad because it defies intention and because it hurts performance.
I realize there is room for different programming styles, but personally, I think that even though this works, and I can see what the code is attempting to do, it also hurts readability and code clarity, making it that much more difficult for the maintenance programmers to follow. An if statement is much more appropriate here.
You should not use exceptions for control flow simply because it is bad design. It doesn't make sense. Exceptions are for exceptional cases, not for normal flow. Performance probably won't be an issue in this situation because for most modern applications on modern hardware, you could throw exceptions all day long and the user wouldn't notice a performance hit. However, if this is a high performance application processing a lot of data or doing a lot of some sort of work, then yes, performance would be a concern.