Load Assembly from Dll : Assembly « Reflection « C# / CSharp Tutorial






using System;
using System.Reflection;
using System.Resources;
using System.Collections.Generic;
using System.Text;


    namespace AssemblyDemo1
    {
        class Employee
        {
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            Assembly a = Assembly.GetExecutingAssembly();
            Console.WriteLine(a.GetName().Name, a.Location);
            Console.WriteLine(a.GlobalAssemblyCache);
            Console.WriteLine(a.ImageRuntimeVersion);

            Assembly otherAssembly = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + "\\SampleAssembly.DLL");
            Console.WriteLine("Other Assembly: {0}", otherAssembly.GetName().Name);
            Console.WriteLine("Types contained in {0}", otherAssembly.GetName().Name);
            foreach (Type t in otherAssembly.GetTypes())
            {
                Console.WriteLine(t.Name);
            }
        }
    }








19.12.Assembly
19.12.1.Load Assembly from Dll
19.12.2.Reflecting An Assembly
19.12.3.Reflecting On A Type
19.12.4.Execute Assembly
19.12.5.Search member method in Assembly
19.12.6.Assembly Tree Viewer
19.12.7.DefineDynamicAssembly method and AssemblyResolve event.
19.12.8.Assembly makes internal types and internal members visible to the assembly called your_assemblies.
19.12.9.Use the file name to load the assembly into the current application domain.