using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ReflectCallPrivateMethod { class Program { static void Main(string[] args) { BasePage pb = new BasePage(); Type ty = pb.GetType(); System.Reflection.MethodInfo m = ty.GetMethod("Insert", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); m.Invoke(pb, null); Console.ReadLine(); } } class BasePage { private void Insert() { Console.WriteLine("擦 , 怎么跑这么快"); } } }