title: optional array Parameter in C#
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3480382/passing-an-empty-array-as-default-value-of-optional-parameter-in-c-sharp">passing an empty array as default value of optional parameter in c#</a>  </p>
  </blockquote>
  
  
  
  <p>I have a method that looks like below. Currently, the parameter <code>tags</code> is NOT optional</p>
  
  <pre><code>void MyMethod(string[] tags=null)
  {
     tags= tags ?? new string[0];
     /*More codes*/
  }
  </code></pre>
  
  <p>I want to make parameter <code>tags</code> optional, as per <code>c#</code> , to make a parameter optional you can set a default value in method signature. I tried the following hacks but none worked. </p>
  
  <p><strong>Code that didn't work - 1</strong></p>
  
  <pre><code>void MyMethod(string[] tags=new string[0]){}
  </code></pre>
  
  <p><strong>Code that didn't work - 2</strong></p>
  
  <pre><code>void MyMethod(string[] tags={}){}
  </code></pre>
  
  <p>Please suggest what I am missing.</p>
  
  <hr>
  
  <p>I have already seen this question:</p>
  
  <p><a href="https://stackoverflow.com/questions/3480382/passing-an-empty-array-as-default-value-of-optional-parameter-in-c-sharp">Passing an empty array as default value of an optional parameter</a></p>