ValidateCountAttribute Class

Validates whether the number of items for a multi-value or dictionary argument is in the specified range.

Definition

Namespace: Ookii.CommandLine.Validation
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 5.0.0+724ca9b7fa5edc075ec2ae65044e61b0d494fd1c
C#
public class ValidateCountAttribute : ArgumentValidationWithHelpAttribute
Inheritance
Object    Attribute    ArgumentValidationAttribute    ArgumentValidationWithHelpAttribute    ValidateCountAttribute

Remarks

If the argument is optional and has no value, this validator will not be used, so zero values is valid regardless of the lower bound specified. If you want zero values to be invalid, make it a required argument.

This validator will not be checked until all arguments have been parsed.

If this validator is used on an argument that is not a multi-value or dictionary argument, validation will always fail.

Constructors

ValidateCountAttribute Initializes a new instance of the ValidateCountAttribute class.

Properties

AllowNoValue Gets or sets a value that indicates whether the minimum bound will be enforced if the argument was not specified at all.
ErrorCategory Gets the error category used for the CommandLineArgumentException when validation fails.
(Inherited from ArgumentValidationAttribute)
IncludeInUsageHelp Gets or sets a value that indicates whether this validator's help should be included in the argument's description.
(Inherited from ArgumentValidationWithHelpAttribute)
Maximum Get the inclusive upper bound on the number of elements.
Minimum Gets the inclusive lower bound on the number of elements.
TypeIdWhen implemented in a derived class, gets a unique identifier for this Attribute.
(Inherited from Attribute)

Methods

EqualsReturns a value that indicates whether this instance is equal to a specified object.
(Inherited from Attribute)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetErrorMessage Gets the error message to display if validation failed.
(Overrides ArgumentValidationAttributeGetErrorMessage(CommandLineArgument, Object))
GetHashCodeReturns the hash code for this instance.
(Inherited from Attribute)
GetTypeGets the Type of the current instance.
(Inherited from Object)
GetUsageHelp Gets the usage help message for this validator.
(Inherited from ArgumentValidationWithHelpAttribute)
GetUsageHelpCore Gets the usage help message for this validator.
(Overrides ArgumentValidationWithHelpAttributeGetUsageHelpCore(CommandLineArgument))
IsDefaultAttributeWhen overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.
(Inherited from Attribute)
IsValidPostConversion Determines if the argument's value is valid after it was converted to the argument's type.
(Inherited from ArgumentValidationAttribute)
IsValidPostParsing Determines if the argument's item count is in the range.
(Overrides ArgumentValidationAttributeIsValidPostParsing(CommandLineArgument))
IsValidPreConversion Determines if the argument's raw string value is valid.
(Inherited from ArgumentValidationAttribute)
MatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object.
(Inherited from Attribute)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
ToStringReturns a string that represents the current object.
(Inherited from Object)
ValidatePostConversion Validates the argument value after it was converted to the argument's type, and throws an exception if validation failed.
(Inherited from ArgumentValidationAttribute)
ValidatePostParsing Validates the argument value after it was converted to the argument's type, and throws an exception if validation failed.
(Inherited from ArgumentValidationAttribute)
ValidatePreConversion Validates the argument raw argument value, and throws an exception if validation failed.
(Inherited from ArgumentValidationAttribute)

Thread Safety

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.

See Also