title: How do you tell if an option was specified when using System.CommandLine?
body: <p>With a root command:</p>
  <pre><code>new RootCommand
  {
      new Option&lt;string&gt;(&quot;--myoption&quot;)
  };
  </code></pre>
  <p>how do you tell the difference between</p>
  <pre><code>./myapp
  </code></pre>
  <p>and</p>
  <pre><code>./myapp --myoption &quot;&quot;
  </code></pre>
  <p>?</p>
  <p>I initially assumed that the option would be null if it wasn't specified, but it's not, it's an empty string :( Adding an explicit default of <code>null</code> also doesn't work; this code still prints out <code>&quot;&quot;</code> when no options are passed in:</p>
  <pre><code>static void Main(string[] args)
  {
      var rootCommand = new RootCommand
      {
          new Option&lt;string&gt;(&quot;--myoption&quot;, () =&gt; null)
      };
      rootCommand.Handler = CommandHandler.Create&lt;string&gt;(Run);
      rootCommand.Invoke(args);
  }
  
  private static void Run(string myoption)
  {
      Console.WriteLine(myoption == null ? &quot;(null)&quot; : '&quot;' + myoption + '&quot;');
  }
  </code></pre>
  <p>If the default is set to a non-null string, the default does come through as expected; only <code>null</code> is mysteriously changed into an empty string.</p>