ArgumentException.Message Property


获取错误消息和参数名;如果未设置参数名,则仅获取错误消息。Gets the error message and the parameter name, or only the error message if no parameter name is set.

 virtual property System::String ^ Message { System::String ^ get(); };
public override string Message { get; }
member this.Message : string
Public Overrides ReadOnly Property Message As String

Property Value


描述异常的详细信息的文本字符串。A text string describing the details of the exception. 此属性的值采用以下两种形式之一:The value of this property takes one of two forms:

条件Condition Value
paramName 是空引用(在 Visual Basic 中为 Nothing)或长度为零。The paramName is a null reference (Nothing in Visual Basic) or of zero length. 传递到构造函数的 message 字符串。The message string passed to the constructor.
paramName 不是空引用(在 Visual Basic 中为 Nothing)并且长度大于零。The paramName is not null reference (Nothing in Visual Basic) and it has a length greater than zero. 附有无效参数名的 message 字符串。The message string appended with the name of the invalid parameter.


此属性将重写 MessageThis property overrides Message. 应本地化错误消息。The error message should be localized.

Applies to