How to call private generic method in C# passing type in runtime
<p>I tried code below in .NET 3.5 but mi is null.
How to call private generic method so that type parameter can be passed at runtime?
If SaveEntityGeneric is marked as public this code works OK but I dont wat to make it public since it is only used in other method in same class to pass this class type using GetType().</p>

<pre><code>using System.Reflection;

public class Main1
{
    static void Main()
    {
        new Class1().Test();
    }
}

class Class1
{

    public void Test()
    {
        var mi = GetType().GetMethod("SaveEntityGeneric", BindingFlags.NonPublic);
        // why mi is null ?
        var gm = mi.MakeGenericMethod(GetType());
        gm.Invoke(this, null);
    }

    void SaveEntityGeneric&lt;TEntity&gt;()
    {
    }
}
</code></pre>
