In C# programming, exception handling is performed by try/catch statement. The try block in C# is used to place the code that may throw exception. The catch block is used to handled the exception. The catch block must be preceded by try block.
C# example without try/catch
Output:
Unhandled Exception: System.DivideByZeroException: Attempted to divide by zero.
C# try/catch example
Output:
System.DivideByZeroException: Attempted to divide by zero. Rest of the code
0 comments:
Post a Comment
Note: only a member of this blog may post a comment.