.NET Core use Configuration to bind to Options with Array : <p>Using the .NET Core <code>Microsoft.Extensions.Configuration</code> <strong>is it possible to bind to a Configuration to an object that contains an array?</strong></p>

<p><code>ConfigurationBinder</code> has a method <a href="https://github.com/aspnet/Configuration/blob/dev/src/Microsoft.Extensions.Configuration.Binder/ConfigurationBinder.cs#L273-L305" rel="noreferrer">BindArray</a>, so I'd assume it would work.</p>

<p>But when I try it out I get an exception: </p>

<blockquote>
  <p><code>System.NotSupportedException: ArrayConverter cannot convert from System.String.</code></p>
</blockquote>

<p>Here's my slimmed down code:</p>

<pre><code>public class Test
{
   private class ExampleOption
   { 
      public int[] Array {get;set;}
   }

   [Test]
   public void CanBindArray()
   {
       // ARRANGE
       var config =
            new ConfigurationBuilder()
            .AddInMemoryCollection(new List&lt;KeyValuePair&lt;string, string&gt;&gt;
            {
                new KeyValuePair&lt;string, string&gt;("Array", "[1,2,3]")
            })
            .Build();

        var exampleOption= new ExampleOption();

        // ACT
        config.Bind(complexOptions); // throws exception

       // ASSERT
       exampleOption.ShouldContain(1);
   }
}
</code></pre>
