title: How to use Reflection to call a method that takes a string array as argument in C#
body: <p>I have a method as shown below...</p>
  
  <pre><code>public bool MakeRequest(string[] args)
      {
          try
          {
              sXmlRequest = args[0];
              sResponse = "";
              Console.WriteLine(sXmlRequest);
              sw.Write(sXmlRequest);
              sw.Flush();
              sResponse = sr.ReadToEnd();
              return true;
          }
          catch (Exception e)
          {
              sResponse = e.Message;
              return false;
          }
  
      }
  </code></pre>
  
  <p>I have to call this method using Reflection, because of the way the entire framework is setup.</p>
  
  <p>Here is the code I'm using to call it</p>
  
  <pre><code>string[] innerargs = {"Dummy Args"};
  string pAssembly = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\TCPConnector.dll";
  Assembly assemblyInstance = Assembly.LoadFrom(pAssembly);
  Type tConnector = assemblyInstance.GetType("Fit.TcpConnector");
  Object oLateBound = assemblyInstance.CreateInstance(tConnector.FullName);
  
  result = tConnector.InvokeMember("MakeRequest", BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance, null, oLateBound, innerargs);
  </code></pre>
  
  <p>This is returning me MissingMethodException saying the method Fit.TcpConnector.MakeRequest is not found.</p>
  
  <p>However, if I change the signature of the MakeRequest to </p>
  
  <pre><code>  public bool MakeRequest(string args)
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>  public bool MakeRequest(string[] args)
  </code></pre>
  
  <p>then, it is working. Can anybody point me in right direction in calling the function which takes array as its parameter?</p>