ArgumentValidationAttributeGetErrorMessage Method

Gets the error message to display if validation failed.

Definition

Namespace: Ookii.CommandLine.Validation
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 5.0.0+724ca9b7fa5edc075ec2ae65044e61b0d494fd1c
C#
public virtual string GetErrorMessage(
	CommandLineArgument argument,
	Object? value
)

Parameters

argument  CommandLineArgument
The argument that was validated.
value  Object
The argument value. If not , this must be a String or an instance of CommandLineArgumentElementType.

Return Value

String
The error message.

Remarks

The value parameter is a String if the IsValidPreConversion(CommandLineArgument, ReadOnlyMemoryChar) method failed, and an instance of CommandLineArgumentElementType if the IsValidPostConversion(CommandLineArgument, Object) method failed. If the IsValidPostParsing(CommandLineArgument) method failed, value will be .

Override this method in a derived class to provide a custom error message. Otherwise, it will return a generic error message.

See Also