Assembly Loader : Assembly Load « Assembly « C# / CSharp Tutorial






using System;
using System.Reflection;
using System.IO;

public class AssemblyLoader
{
  private Assembly LoadedAssembly;

  public AssemblyLoader(string LoadedAssemblyName, bool PartialName)
  {
      Console.WriteLine(LoadedAssemblyName);
    if(PartialName == true)
      LoadedAssembly = Assembly.LoadWithPartialName(LoadedAssemblyName);
    else
      LoadedAssembly = Assembly.Load(LoadedAssemblyName);
    WritePropertiesToConsole();

  }

  private void WritePropertiesToConsole()
  {
    Console.WriteLine("Full Name: {0}", LoadedAssembly.FullName);
    Console.WriteLine("Location: {0}", LoadedAssembly.Location);
    Console.WriteLine("Code Base: {0}", LoadedAssembly.CodeBase);
    Console.WriteLine("Escaped Code Base: {0}", LoadedAssembly.EscapedCodeBase);
    Console.WriteLine("Loaded from GAC: {0}", LoadedAssembly.GlobalAssemblyCache);
  }
}

public class MainClass
{
  static void Main(string[] args)
  {
    AssemblyLoader Loader;

    Loader = new AssemblyLoader("System.Xml, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", false);
    Loader = new AssemblyLoader("System.Xml", false);
    Loader = new AssemblyLoader("System.Xml", true);
  }
}








12.4.Assembly Load
12.4.1.Assemblies
12.4.2.difference between Assembly.Load and Assembly.LoadFrom
12.4.3.Load types(classes) from a Assembly(exe file)
12.4.4.Load the System.Xml assembly using an AssemblyName
12.4.5.Create Type by Assembly qualifed type name
12.4.6.Late Binding
12.4.7.Assembly unloading
12.4.8.Dynamic assembly introspection
12.4.9.Deeper Reflection: Listing All the Types in an Assembly
12.4.10.Assembly Loader
12.4.11.GetManifestResourceStream