Export (0) Print
Expand All
Expand Minimize

Code: Throwing an Exception (Visual C#)

Visual Studio .NET 2003
 

This example throws the exception System.ApplicationException.

Example

throw new ApplicationException();

Compiling the Code

Copy the code and paste it into the Main method of a console application.

Robust Programming

Unhandled exceptions cause application execution to stop.

See Also

Code: Catching an Exception (Visual C#) | throw | try-catch | ApplicationException Class | Exception Class | General Language Example Topics

Show:
© 2015 Microsoft