title: .NET 2.0: Invoking Methods Using Reflection And Generics Causes Exception
body: <p>I'm new to Stack Overflow, so forgive me. I've just started transititoning over to C# and I am stuck on a problem.</p>
  
  <p>I am wanting to pass a generic class in and call a method from that class. So, my code looks as such:</p>
  
  <pre><code>public void UpdateRecords&lt;T&gt;(T sender) where T : new() //where T: new() came from Resharper
  {
      Type foo = Type.GetType(sender.GetType().ToString());
      object[] userParameters = new object[2];
      userParameters[0] = x;
      userParameters[1] = y;
      sender = new T(); //This was to see if I could solve my exception problem
      MethodInfo populateRecord = foo.GetMethod("MethodInOtherClass");
      populateMethod.Invoke(sender, userParameters);
  }
  </code></pre>
  
  <p>Exception thrown: "Object reference not set to an instance of an object."</p>
  
  <p>Again, I really apologize, as I am nearly brand new to C# and this is the first time I've ever handled reflection and generics. Thank you!</p>