Assembly.Location : Assembly « System.Reflection « C# / C Sharp by API






Assembly.Location

  
 
  

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);
  }
}

 

   
    
  








Related examples in the same category

1.Assembly.CodeBase
2.Assembly.EntryPoint
3.Assembly.EscapedCodeBase
4.Assembly.Evidence
5.Assembly.FullName
6.Assembly.GetCallingAssembly()
7.Assembly.GetCustomAttributes
8.Assembly.GetEntryAssembly()
9.Assembly.GetExecutingAssembly()
10.Assembly.GetExportedTypes
11.Assembly.GetName
12.Assembly.GetReferencedAssemblies
13.Assembly.GetTypes()
14.Assembly.GlobalAssemblyCache
15.Assembly.Load(AssemblyName name2)
16.Assembly.Load(String name)
17.Assembly.LoadFrom(String assemblyName)