This page lists the key members of the System.Exception
class, the base class for all exceptions in the .NET Framework. Understanding these members is crucial for effective error handling and debugging.
Commonly Used Members
Message
Property
Gets a message that describes the current exception.
InnerException
Property
Gets the exception that is the cause of the current exception.
StackTrace
Property
Gets a string representation of the frames in the call stack.
GetType()
Method
Returns the runtime type of the current instance.
ToString()
Method
Overrides to return a string that represents the current exception.
Data
Property
Gets a dictionary containing information about the exception that is specific to the application.
Constructors
The System.Exception
class provides several constructors to create exception objects. The most common ones are:
Exception()
Initializes a new instance of the Exception
class.
Exception(string message)
Initializes a new instance of the Exception
class with a specified error message.
Exception(string message, Exception innerException)
Initializes a new instance of the Exception
class with a specified error message and a reference to the inner exception that is the cause of this exception.