Why can't I write just a try with no catch or finally?

Posted by Camilo Martin on Stack Overflow See other posts from Stack Overflow or by Camilo Martin
Published on 2010-12-27T16:34:41Z Indexed on 2010/12/27 16:53 UTC
Read the original article Hit count: 136

Filed under:
|
|
|
|

Sometimes I do this and I've seen others doing it too:

VB:

Try
    DontWannaCatchIt()
Catch
End Try

C#:

try 
{ 
    DontWannaCatchIt();
} 
catch {}

I know I should catch every important exception

and do something about it, but sometimes it's not important to - or am I doing something wrong?

Is this usage of the try block incorrect, and the requirement of at least one catch or finally block an indication of it?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET