// 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 TestOne { public class Test { public static void Check() { Console.WriteLine("TestOne"); } } } namespace TestTwo { public class Test { public static void Check() { Console.WriteLine("TestTwo"); } } } namespace E { class MainClass { public static void Main(string[] args) { string[] ns = { "TestOne", "TestTwo" }; foreach(string ns1 in ns) { Type c = Assembly.GetExecutingAssembly().GetType(ns1 + ".Test", false, false); c.InvokeMember("Check", BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Static | BindingFlags.InvokeMethod, null, null, null); } } } }