/// <summary> /// Parses the specified <see cref="System.String"/> into the return type. /// </summary> /// <param name="parsedOption"></param> /// <returns>The parsed value.</returns> public List <T> Parse(ParsedOption parsedOption) { var parser = _parserFactory.CreateParser <T>(); return(parsedOption.Values.Select(value => { var clone = parsedOption.Clone(); clone.Value = value; return parser.Parse(clone); }).ToList()); }
/// <summary> /// Determines whether the specified <see cref="System.String"/> can be parsed by this <see cref="ICommandLineOptionParser{T}"/>. /// </summary> /// <param name="parsedOption"></param> /// <returns><c>true</c> if the specified <see cref="System.String"/> can be parsed by this <see cref="ICommandLineOptionParser{T}"/>; otherwise <c>false</c>.</returns> public bool CanParse(ParsedOption parsedOption) { if (parsedOption == null) { return(false); } if (parsedOption.HasValue == false) { return(false); } var parser = _parserFactory.CreateParser <T>(); return(parsedOption.Values.All(value => { var clone = parsedOption.Clone(); clone.Value = value; clone.Values = new[] { value }; clone.AdditionalValues = new string[0]; return parser.CanParse(clone); })); }