Esempio n. 1
0
        /// <summary>
        /// Checks if the empty string is a valid value for this argument.
        /// </summary>
        /// <param name="parserOptions">Parser options.</param>
        /// <returns>true if it is valid; false otherwise.</returns>
        internal bool IsEmptyStringValid(CommandLineParserOptions parserOptions)
        {
            var options    = parserOptions.DeepClone().With().Quiet().Apply();
            var parseState = new ArgumentParser(ContainingSet, this, options, /*destination=*/ null);

            return(ArgumentType.TryParse(parseState.ParseContext, string.Empty, out object parsedEmptyString) &&
                   parseState.TryValidateValue(
                       parsedEmptyString,
                       new ArgumentValidationContext(parseState.ParseContext.FileSystemReader),
                       reportInvalidValue: false));
        }
Esempio n. 2
0
 private bool IsEmptyStringValid() =>
 ArgumentType.TryParse(_argumentParseContext, string.Empty, out object parsedEmptyString) &&
 TryValidateValue(
     parsedEmptyString,
     new ArgumentValidationContext(_argumentParseContext.FileSystemReader),
     reportInvalidValue: false);