Mega Code Archive

 
Categories / C# / Data Types
 

Examining a Currently Running Process for Type Information

using System; using System.Reflection; using System.Diagnostics;     class AssemType {   public static void Main(string[] args) {        Process p = Process.GetCurrentProcess();        string assemblyName = p.ProcessName + ".exe";        Console.WriteLine("Examining : {0}", assemblyName);        Assembly a = Assembly.LoadFrom(assemblyName);            Type[] types = a.GetTypes();        foreach(Type t in types)        {             Console.WriteLine("\nType : {0}",t.FullName);             Console.WriteLine("\tBase class: {0}",t.BaseType.FullName);        }   } }