title: Pass array as a command line argument to Asp.Net Core
body: <p>Need to pass array as a command line argument to Asp.Net Core hosted service. </p>
  
  <p>Added providers</p>
  
  <pre><code>config
    .AddJsonFile("appsettings.json")
    .AddCommandLine(args);
  </code></pre>
  
  <p>somewhere in application I have </p>
  
  <pre><code>var actions = _configuration.GetSection("actions").Get&lt;List&lt;string&gt;&gt;();
  foreach (var action in actions)
  {
     Console.WriteLine(action);
  }
  </code></pre>
  
  <p>Try to run app like</p>
  
  <pre><code>dotnet MyService.dll --actions Action1,Action2
  dotnet MyService.dll --actions [Action1,Action2]
  dotnet MyService.dll --actions ["Action1","Action2"]
  </code></pre>
  
  <p>but no results, the <code>actions</code> is <code>null</code></p>
  
  <p>When I add <code>"actions": ["Action1","Action2"]</code> to appsettings.json then binding works well. </p>
  
  <p>How to pass array as a command line argument? </p>
  
  <p>I can get it in this way <code>_configuration.GetValue&lt;string&gt;("actions").Split(",");</code>, but how to bind it to list?</p>