question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error CS0029 Cannot implicitly convert type 'CommandLine.ParserResult<Options>' to 'Options'

See original GitHub issue
using CommandLine;
using System;
using System.Windows.Forms;

namespace MWR_Config_Editor
{
    static class Program
    {
        private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
        public static Options Arguments;
        public class Options
        {
            [Option('c', "console", Required = false, HelpText = "Enable console")]
            public bool Verbose { get; set; }
        }
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            Logger.Debug("Program started");
            Arguments = Parser.Default.ParseArguments<Options>(args);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Main());
            Logger.Debug("Program ended");
        }
    }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
moh-hassancommented, 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:

var result = Parser.Default.ParseArguments<Options>(args);
Arguments = result.Value;
1reaction
Bluscreamcommented, Sep 24, 2019

And how am i supposed to access the variables inside it then? ParserResult does not contain a instance of Options

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compiler Error CS0029
In this article. Cannot implicitly convert type 'type' to 'type'. The compiler requires an explicit conversion. For example, you may need to ...
Read more >
Cannot implicitly convert type 'type' to 'type' in C# LINQ
1 Answer. You are using different data sets (in your case anonymous types) and trying to assign them to the same variable grouped...
Read more >
How do I resolve error 'cannot implicitly convert type 'string' ...
The reason that you are getting this error is that EmployeeNumber is declared as an array of strings ( string[] ) and you...
Read more >
Cannot implicitly convert type `string' to `UnityEngine.UI.Text'
I have a GUImanager script, and want to make a volume label, but I get the error, here is my code (LINE 29,27)...
Read more >
C# error CS0029: Cannot implicitly convert type 'int' to 'bool ...
The error message Cannot implicitly convert type 'int' to 'bool' is saying that you're trying to store an int into a bool variable,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found