title: Using Reflection to get static method with its parameters
body: <p>I'm using a public static class and static method with its parameters:</p>
  
  <pre><code>public static class WLR3Logon
  {
     static void getLogon(int accountTypeID)
     {}
  }
  </code></pre>
  
  <p>Now I am trying to fetch the method with its parameters into another class and using the following code:</p>
  
  <pre><code>MethodInfo inf = typeof(WLR3Logon).GetMethod("getLogon",
      BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
  
  int[] parameters = { accountTypeId };
  
  foreach (int parameter in parameters)
  {
      inf.Invoke("getLogon", parameters);
  }
  </code></pre>
  
  <p>But its giving me error </p>
  
  <blockquote>
    <p>"Object reference not set to an instance of an object."</p>
  </blockquote>
  
  <p>Where I'm going wrong.</p>