DekGenius.com
[ Team LiB ] Previous Section Next Section

ExceptionCF 1.0, ECMA 1.0, serializable

System (mscorlib.dll)class

This is the base class for all .NET exceptions. .NET Framework exceptions are generally derived from SystemException, and user-defined exceptions are generally derived from ApplicationException.

In some cases, one exception may throw another; this is often the case when using layered architectures. For example, a persistence layer may throw a persistence-related exception (DatabaseNotFoundException), whose semantics are undefined at a higher level (such as the UI layer). In this case, a middle layer may throw a new exception-derived type (such as PersistenceException), but doesn't wish to lose the original source of the exception—instead, it wraps the original exception by setting it to be the InnerException. In this way, a layer can communicate a lower-level exception to higher layers without losing information or violating encapsulation.

The StackTrace property is a string containing the stacktrace. This permits determination of the call sequence leading up to the line that threw the exception. HelpLink contains a link to a help file with information about the exception. Message contains a text message that describes the exception.

public class Exception : System.Runtime.Serialization.ISerializable {
// Public Constructors
   public Exception( );
   public Exception(string message);
   public Exception(string message, Exception innerException);
// Protected Constructors
   protected Exception(System.Runtime.Serialization.SerializationInfo info,
        System.Runtime.Serialization.StreamingContext context);
// Public Instance Properties
   public virtual string HelpLink{set; get; }
   public Exception InnerException{get; }
   public virtual string Message{get; }
   public virtual string Source{set; get; }
   public virtual string StackTrace{get; }
   public MethodBase TargetSite{get; }
// Protected Instance Properties
   protected int HResult{set; get; }
// Public Instance Methods
   public virtual Exception GetBaseException( );
   public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info,
        System.Runtime.Serialization.StreamingContext context)
// implements ISerializable
   public override string ToString( );    
// overrides object
}

Subclasses

ApplicationException, SystemException, System.IO.IsolatedStorage.IsolatedStorageException

Returned By

System.IO.ErrorEventArgs.GetException( ), System.Reflection.ReflectionTypeLoadException.LoaderExceptions, System.Threading.ThreadExceptionEventArgs.Exception

Passed To

Multiple types

    [ Team LiB ] Previous Section Next Section