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
{{ message }}
Repository navigation
Error CS0029 Cannot implicitly convert type 'CommandLine.ParserResult<Options>' to 'Options' #511
usingCommandLine;usingSystem;usingSystem.Windows.Forms;namespaceMWR_Config_Editor{staticclassProgram{privatestaticreadonlyNLog.LoggerLogger=NLog.LogManager.GetCurrentClassLogger();publicstaticOptionsArguments;publicclassOptions{[Option('c',"console",Required=false,HelpText="Enable console")]publicboolVerbose{get;set;}}/// <summary>/// The main entry point for the application./// </summary>[STAThread]staticvoidMain(string[]args){Logger.Debug("Program started");Arguments=Parser.Default.ParseArguments<Options>(args);Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Application.Run(newMain());Logger.Debug("Program ended");}}}
Activity
moh-hassan commentedon Sep 24, 2019
modify:
to
Bluscream commentedon Sep 24, 2019
And how am i supposed to access the variables inside it then? ParserResult does not contain a instance of Options
IB38 commentedon Sep 25, 2019
You need to use WithParsed, something like:
Parser.Default.ParseArguments<Options>(args).WithParsed(result => Arguments = result);moh-hassan commentedon Jul 14, 2020
The [Pr #634) exposes The Parsed option Value to the base class, available in develop branch and will be released in v2.9.
You can:
Bluscream commentedon Jul 14, 2020
Thanks :)