Class ErrorMessageAttribute
Attribute to customize the message of enum
errors.
[AttributeUsage(AttributeTargets.Field)]
public sealed class ErrorMessageAttribute : Attribute
- Inheritance
-
ErrorMessageAttribute
- Inherited Members
Examples
public enum ParseError
{
[ErrorMessage("The value was too large to fit in the target type.")]
Overflow,
[ErrorMessage("The input string did not match the expected pattern.")]
InvalidSyntax,
}
Constructors
ErrorMessageAttribute(string)
Attribute to customize the message of enum
errors.
public ErrorMessageAttribute(string message)
Parameters
message
string
Examples
public enum ParseError
{
[ErrorMessage("The value was too large to fit in the target type.")]
Overflow,
[ErrorMessage("The input string did not match the expected pattern.")]
InvalidSyntax,
}
Properties
Message
The error message.
public string Message { get; }