From the course: .NET Fundamentals: Concepts, APIs, and Libraries in the .NET Framework

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Handling exceptions in .NET

Handling exceptions in .NET

- [Instructor] All frameworks provide a way to signal failure to the calling code. For example some languages return error codes when something goes wrong. Other systems might signal success in a function call by returning the value that you requested and signal failure by returning a negative number or some other special value .net uses exceptions for this purpose because .net is a strong type system. You won't be surprised to learn that .net has exception classes. They encapsulate the information needed by the CLR to handle the runtime error. The .net framework provides a rich set of exception classes that are used to represent different types of errors that can occur during the execution of a program. For example, here are some of the exception classes for working with database errors and the first thing you want to note is that by convention all exceptions in .net end with the word exception. So the one you see at the…

Contents