// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Reflection; namespace E { public class Test { private void NoAccessMethod() { Console.WriteLine("What happended here?"); } } public class Program { public static void Main(string[] args) { Test o = new Test(); //o.NoAccessMethod(); MethodInfo mi = o.GetType().GetMethod("NoAccessMethod", BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[0], null); mi.Invoke(o, new object[0]); } } }