[C# Helper]
Index Books FAQ Contact About Rod
[Beginning Database Design Solutions, Second Edition]

[Beginning Software Engineering, Second Edition]

[Essential Algorithms, Second Edition]

[The Modern C# Challenge]

[WPF 3d, Three-Dimensional Graphics with WPF and C#]

[The C# Helper Top 100]

[Interview Puzzles Dissected]

[C# 24-Hour Trainer]

[C# 5.0 Programmer's Reference]

[MCSD Certification Toolkit (Exam 70-483): Programming in C#]

Title: See a hierarchy of exception classes for use in C#

The example Throw a standard exception in C# explains how to throw exceptions to indicate a problem in a program. Throwing an exception is easiest if you can find an existing exception class that correctly represents your situation. The following list shows a hierarchy of some of the most useful exception classes.

For example, if you want to make a stub or placeholder method to reserve space for code you will add later, you can use the following code to make the method throw the NotImplementedException exception.

throw new NotImplementedException( "The SelfDestruct method is not yet implemented.");

Now you can write other code in the program that calls this method and it will compile, but it will fail if you invoke the method at runtime.

© 2009-2023 Rocky Mountain Computer Consulting, Inc. All rights reserved.