I tried the code below in .NET 3.5, but mi is null. How to call a private common method so that a type parameter can be passed at runtime? If SaveEntityGeneric is marked as open, this code works fine, but I do not want to publish it, because it is used only in another method of the same class to pass this class type using GetType ().
using System.Reflection; public class Main1 { static void Main() { new Class1().Test(); } } class Class1 { public void Test() { var mi = GetType().GetMethod("SaveEntityGeneric", BindingFlags.NonPublic);
source share