Discussion Locked

Under what circumstances is try..catch{} OK ?

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Bettter yet if this was in the setter method of a public property, with an event handler in it?

.NET 2.0 set the binding source property (listBox, Combox etc..), this fires SelectedItemChanged.
Put any code in the event handler that throws an unhandled exception, and the component f'ing swallows it.

try
{
bs = value;
}
catch
{
displayvalue = "";
}

I know how to get round it, there's even a comment in there about why teh code looks strange.

What I can't figure out is why some one at Redmond thought this was the way to go.

What am I missing.?

2 replies

by tig2

Timing is everything. I will bet that Wayne and Locrian will have an opinion at the very least. But it is the weekend and for some, a long weekend. So you didn't attract the attention you deserve to attract.

Bubble back up during the week and you will likely get better response.

This discussion is closed to new replies.