public AddOption ( Char ShortOption, Action |
||
ShortOption | Char | A short option. |
Delegate | Action |
What to do with the value of the character option. |
Verification | String | An optional regular expression for verification. |
Résultat |
public CommandLineParser AddOption(Char ShortOption, Action<String> Delegate, String Verification = null)
{
ShortOptions.Add(ShortOption, Delegate);
return this;
}
CommandLineParser::AddOption ( Char ShortOption, String LongOption, Action |
|
CommandLineParser::AddOption ( String LongOption, Action |
|
CommandLineParser::AddOption ( ) : |
/// <summary> /// Apply/store this command line parser option. /// </summary> /// <returns></returns> public CommandLineParser Apply() { if (!_Short.HasValue && LongOption == null) { throw new ArgumentException("Either a short or long option must be defined!"); } if (Action == null) { throw new ArgumentException("An action has to be defined for this option!"); } if (_Short.HasValue) { CommandLineParser.AddOption(_Short.Value, Action); } if (LongOption != null) { CommandLineParser.AddOption(LongOption, Action); } return(CommandLineParser); }