Krizsán Zoltán, iit.NET Framework Class Library (FCL) 45 Példa – assembly fv.-ei using System; using System.Reflection; public class LoadInvoke{ public static void Main(string[] args){ public static void Main(string[] args){ Assembly a = Assembly.LoadFrom(args[0]); Assembly a = Assembly.LoadFrom(args[0]); Type[] mytypes = a.GetTypes(); Type[] mytypes = a.GetTypes(); BindingFlags flags = (BindingFlags.NonPublic | BindingFlags.Public | BindingFlags flags = (BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly); BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly); foreach(Type t in mytypes) { foreach(Type t in mytypes) { MethodInfo[] mi = t.GetMethods(flags); MethodInfo[] mi = t.GetMethods(flags); Object obj = Activator.CreateInstance(t); Object obj = Activator.CreateInstance(t); foreach( MethodInfo m in mi){ m.Invoke(obj, null); } foreach( MethodInfo m in mi){ m.Invoke(obj, null); } } }}
{}