Skip to content

Instantly share code, notes, and snippets.

@leegould
Created February 27, 2012 11:23
Show Gist options
  • Save leegould/1923145 to your computer and use it in GitHub Desktop.
Save leegould/1923145 to your computer and use it in GitHub Desktop.
Get Namespaces
using System;
using System.Linq;
using System.Reflection;
namespace GetNamespaces
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 1)
{
ShowUsage();
return;
}
string assFullPath = args[0];
try
{
Assembly a = Assembly.LoadFrom(assFullPath);
Console.WriteLine("Assembly Items:");
foreach(var t in a.GetTypes().Select(t => t))
{
Console.WriteLine("Name:'{0}' Namespace:'{1}'",t.Name, t.Namespace);
}
}
catch(Exception e)
{
Console.WriteLine("Error loading assembly: {0}", e.Message);
}
}
static void ShowUsage()
{
Console.WriteLine("Show namespaces for assembly.");
Console.WriteLine("\tUsage: {0} [path]", AppDomain.CurrentDomain.FriendlyName);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment