The .NET runtime supports structured exception handling. As part of this mechanism there is a hierarchy of exception classes to help identify the particular error that has occured. The base of the class hierarchy is the System.Exception object.

Back in .NET 1.x days it was suggested that all custom exceptions created by application developers be derived from the System.ApplicationException class but that advice has since been changed and we should derive directly from System.Exception.

One thing to watch out for with exceptions is serialisation issues. If you are passing the object between AppDomains on the local machine or across the network exceptions won’t necessarily serialise correctly so you basically need to implement the ISerializable interface. One of the best articles on this subject remains Eric Gunnerson’s “The Well-Tempered Exception”.