Mega Code Archive

 
Categories / C# / Reflection
 

List Assembly Info

using System; using System.Collections; using System.Reflection; public class MainClass{     public static void Main(){         Assembly LoadedAsm = Assembly.LoadFrom("System.String");         Console.WriteLine(LoadedAsm.FullName);         if (LoadedAsm.GlobalAssemblyCache == true) {             Console.WriteLine("\tThis is a Global Assembly");         } else {             Console.WriteLine("\tThis is a Local Assembly");         }         MethodInfo entry = LoadedAsm.EntryPoint;         if (entry != null) {             Console.WriteLine("\tAssembly EntryPoint:\t{0}", entry.Name);         } else {             Console.WriteLine("\tThis Assembly has no Entry point.");         }         object[] attrs = LoadedAsm.GetCustomAttributes(true);         if (attrs.Length == 0) {             Console.WriteLine("\tNo Custom Attributes Found");         } else {             Console.WriteLine("\tFound Attributes");             foreach (object o in attrs) {                 Console.WriteLine("\t\t{0}", o.ToString());             }         }     } }