Issue by Virtlink
Sunday Apr 24, 2016 at 11:12 GMT
Originally opened as gsscoder/commandline#310
The Parser.ParseArguments() overloads with a factory function has this signature:
public ParserResult<T> ParseArguments<T>(Func<T> factory, IEnumerable<string> args)
where T : new()
If I provide my own factory function, why does T need to have a public parameterless constructor (new())?
var result = parser.ParseArguments<Options>(() => new Options(true), args);
And on the other hand, why doesn't the non-factory overload of ParseArguments not require a public parameterless constructor? This will cause a runtime-exception when T doesn't have a public parameterless constructor.
var result = parser.ParseArguments<Options>(args);