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