You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var result = CommandLine.Parser.Default.ParseArguments<AddOptions, UpdateOptions, DeleteOptions(args).MapResult(
(AddOptions aopts) => {},
(UpdateOptions upopts) => {},
(DeleteOptions dopts) => {});
It complains that there is no support for more than one Generic and from looking at the code, I didn't see any overrides or extensions to ParseArguments that supports multiple generics. So I was curious if the approach had changed.
MapResult has a final delegate parameter that is required to be of type IEnumerable<Error> for any errors.
Each delegate must return a value - they are Func not Action and each value must be the same type. If you quickly add return ""; to each of those it compiles for me.
Activity
nemec commentedon Nov 2, 2017
Two things:
MapResulthas a final delegate parameter that is required to be of typeIEnumerable<Error>for any errors.FuncnotActionand each value must be the same type. If you quickly addreturn "";to each of those it compiles for me.ravensorb commentedon Nov 2, 2017
Cool So i just tried build 2.1.1-beta and I cannot get the snippet above to compile
nemec commentedon Nov 2, 2017
Did it mention a file/line number?
ravensorb commentedon Nov 2, 2017
Its in my simple test app and when I look at the object explorer I only see a ParseArguments and not other overloads for more generic args.
nemec commentedon Nov 2, 2017
Sorry I misread and thought you were building the source code of the library. This worked for me on the latest beta:
ravensorb commentedon Nov 2, 2017
That helped -- I found the issue :) It appears you must add the using statement
Without that it doesn't find the extension methods or the Error option.