Class AttributeValidator
A validator that uses a System.
Inheritance
System.Object
AttributeValidator
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: McMaster.Extensions.CommandLineUtils.Validation
Assembly: McMaster.Extensions.CommandLineUtils.dll
Syntax
public class AttributeValidator : IValidator, IOptionValidator, IArgumentValidator, ICommandValidator
Constructors
| Improve this Doc View SourceAttributeValidator(ValidationAttribute)
Initializes an instance of Attribute
Declaration
public AttributeValidator(ValidationAttribute attribute)
Parameters
Type | Name | Description |
---|---|---|
System. |
attribute |
Methods
| Improve this Doc View SourceGetValidationResult(CommandArgument, ValidationContext)
Gets the validation result for a command line argument.
Declaration
public ValidationResult GetValidationResult(CommandArgument argument, ValidationContext context)
Parameters
Type | Name | Description |
---|---|---|
Command |
argument | |
System. |
context |
Returns
Type | Description |
---|---|
System. |
GetValidationResult(CommandLineApplication, ValidationContext)
Checks whether the command is valid using any associated validation attributes.
Declaration
public ValidationResult GetValidationResult(CommandLineApplication command, ValidationContext context)
Parameters
Type | Name | Description |
---|---|---|
Command |
command | The command line application to validate |
System. |
context | The context under which validation should be performed |
Returns
Type | Description |
---|---|
System. |
GetValidationResult(CommandOption, ValidationContext)
Gets the validation result for a command line option.
Declaration
public ValidationResult GetValidationResult(CommandOption option, ValidationContext context)
Parameters
Type | Name | Description |
---|---|---|
Command |
option | |
System. |
context |
Returns
Type | Description |
---|---|
System. |