If you are a Java developer, C#'s exception handling mechanism is very similar to Java's, and you will feel very comfortable. [1] There are, of course, new things to learn “ C# has done away with checked exceptions and built in something called inner exceptions, as well as other minor improvements.
C# has four keywords for exception handling “ try , catch , finally , and throw . Notice that C# does not have the throws keyword which Java developers use when declaring methods . I shall start with a general example of exception handling in C# just to warm up a bit. This will be followed by examples on nested try blocks and user -defined exceptions. [2] Then I will discuss the following topics:
|