title: How to pass optional parameters to a method in C#?
body: <p>How to pass optional parameters to a method in C#?</p>
  <p>Suppose I created one method called SendCommand</p>
  <pre><code>public void SendCommand(string command,string strfileName)
  {
              
      if (command == &quot;NLST *&quot; ) //Listing Files from Server.
      {
          //code
      }
      else if (command == &quot;STOR &quot; + Path.GetFileName(uploadfilename)) //Uploading file to Server
      {
          //code
      }
      else if ...
  }
  </code></pre>
  <p>Now I want to call this method in main method like</p>
  <pre><code>SendCommand(&quot;STOR &quot;, filename);
  SendCommand(&quot;LIST&quot;); // In this case i don't want to pass the second parameter
  </code></pre>
  <p>How to achieve that?</p>