2

Possible Duplicate:
Why are Exceptions not Checked in .NET?

Coming from Eclipse/Java, I noticed that in VisualStudio/C# it is not mandatory to care about Exceptions. While Eclipse forces the user to implement a try-catch-block or to add a throws declaration, this is not the case in Visual Studio.

  • What is the reason Visual Studio doesn't inform about unhandled exceptions?

  • Can I configure Visual Studio to force me to implement try-catch-blocks, or at least add a compiler-warning?

Community
  • 1
  • 1
Pedro
  • 4,100
  • 10
  • 58
  • 96

1 Answers1

8

Checked exceptions are not part of .Net, unlike java.

Since the exception does not form a part of the method declaration in c#, any exception can be thrown by any method without the method declaring so. Thus, an exception never requires handling since it is never required to be declared.

Rich O'Kelly
  • 41,274
  • 9
  • 83
  • 114