title: C# Core Web API controller optional Array default value
body: <p>I have a controller with method GetAll which has all params optional (with default value). Concept is to make any of these requests valid:</p>
  
  <pre><code>/crm/contacts
  /crm/contacts?sort=created_by
  /crm/contacts?search=My%20Customer
  /crm/contacts?sort=created_by&amp;take=100
  /crm/contacts?from=10&amp;take=100
  /crm/contacts?search=My%20Customer&amp;sort=created_by&amp;take=100
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>[HttpGet]
  [Route("")]
  public async Task&lt;DTO.CRM.contact[]&gt; GetAllAsync(
       int? from = null,
       int? take = 10,
       string search = null,
       string[] sort = null)
  {
  </code></pre>
  
  <p>In debug, I would suspect sort to be null, instead, I see it as a {string[0]}. I use dotnet core 2.1.4 on macOS.</p>
  
  <p>How can I get sort really null if it is not passed in url?</p>