Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Exception.Message Property

Gets a message that describes the current exception.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public virtual string Message { get; }

Property Value

Type: System.String
The error message that explains the reason for the exception, or an empty string("").

The text of Message should completely describe the error and should, when possible, explain how to correct it. The value of the Message property is included in the information returned by ToString.

The Message property is set only when creating an Exception. If no message was supplied to the constructor for the current instance, the system supplies a default message that is formatted using the current system culture.

Notes to Implementers

If you throw an exception from a property, and you need to refer in the text of Message to the property argument that you set or get, use "value" as the name of the property argument.

Notes to Inheritors

The Message property is overridden in classes that require control over message content or format. Application code typically accesses this property when it needs to display information about an exception that has been caught.

The error message should be localized.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2015 Microsoft