// 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 Demo { public static void Main(string[] args) { Demo o = new Demo(); o.CallAllTestMethods(); } public void CallAllTestMethods() { MethodInfo[] allm = typeof(Demo).GetMethods(); foreach(MethodInfo m in allm) { if(m.Name.StartsWith("Test")) { m.Invoke(this, new object[] { }); } } } public static void Test1() { Console.WriteLine("Test 1"); } public static void Test2() { Console.WriteLine("Test 2"); } } }