CliValidationExtensionsAddValidator(CliArgument, String, String) Method

Adds a validation pattern to an argument. A validation pattern can be used to provide errors based on user input.

Definition

Namespace: DotMake.CommandLine
Assembly: DotMake.CommandLine (in DotMake.CommandLine.dll) Version: 1.8.8
C#
public static void AddValidator(
	this CliArgument argument,
	string validationPattern,
	string validationMessage = null
)

Parameters

argument  CliArgument
The argument to configure.
validationPattern  String
A regular expression pattern used for validation.
validationMessage  String  (Optional)
An error message to show when validationPattern does not match and validation fails.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type CliArgument. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also