Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Method: ConsoleColoredString Validate()

Declaration

public ConsoleColoredString Validate()

Summary

When implemented in a class, returns an error message if the contents of the class are invalid, otherwise returns null.

Remarks

When CommandLineParser invokes this method, all parsed commands and options have already been populated. This method can thus alter the class in application-specific ways, perform further parsing, or further validate the options for constraints such as mutual exclusivity.

To report a validation error, this method can either return the text of the error message, or throw a CommandLineValidationException. The message is passed to the user in the same way as other parse errors (for example, see CommandLineParser.ParseOrWriteUsageToConsole<TArgs>(string[], Func<ConsoleColoredString, ConsoleColoredString>) which prints it to the console).