Export (0) Print
Expand All

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.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft