title: MethodInfo.Invoke performance issue
body: <p>I am reading and writing data to and from a file. The data in the file can be floats, doubles, ints etc. The type is not known until runtime. I will refer to data type stored in the file as Tin. Data is read into or written from arrays of type Tout. This type too is not known until runtime.</p>
  
  <p>The code sequence is something like this. In the Open method Tin and Tout are known, we can create  read and write methods for the known data types.</p>
  
  <pre><code>Open(...)
  {
     MethodInfo ReadMethod = typeof(...)GetMethod("ReadGeneric").MakeGenericMethod(new Type[] {typeof(Tin), typeof(Tout)}));
  }
  </code></pre>
  
  <p>The read write loops repeat millions of times and rely on reflection to invoke the appropriate methods as shown below. </p>
  
  <pre><code>Read loop
  {
     var values = (Tout[])ReadMethod.Invoke(this,new object[]{index});
     process ...
  }
  </code></pre>
  
  <p>When examining this code using a performance profiler I find that c collosal amount if time is spent just invoking the runtime read write methods.  </p>
  
  <p>How do I speed this up.</p>