CliValidationExtensionsAddValidator(CliOption, String, String) Method

Adds a validation pattern to an option's 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 CliOption option,
	string validationPattern,
	string validationMessage = null
)

Parameters

option  CliOption
The option 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 CliOption. 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