Mega Code Archive

 
Categories / C# / Reflection
 

GetNamespaces from Assembly

//Octavalent Extension Methods //http://sdfasdf.codeplex.com/ //Library of extension methods for .Net create by Octavalent (www.octavalent.nl) using System.Collections.Generic; using System.Linq; namespace System.Reflection.OctavalentExtensions {     public static class AssemblyExtensions     {         public static List<string> GetNamespaces(this Assembly assembly)         {             var namespaces = new List<string>();             foreach (Type type in assembly.GetExportedTypes())             {                 namespaces.Add(type.Namespace);             }             return namespaces.Distinct().ToList();         }     } }