Mega Code Archive

 
Categories / C# Tutorial / Reflection
 

Use the file name to load the assembly into the current application domain

using System; using System.Reflection; public class Asmload0 {    public static void Main ()     {              Assembly a = Assembly.Load("example");       // Get the type to use.       Type myType = a.GetType("Example");       // Get the method to call.       MethodInfo mymethod = myType.GetMethod("MethodA");       Object obj = Activator.CreateInstance(myType);       // Execute the method.       mymethod.Invoke(obj,null);    } }