Get Currently Running Process Type Information in CSharp

Description

The following code shows how to get Currently Running Process Type Information.

Example


/*from w  w w .  j a  v  a 2 s.c o  m*/
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);
       }
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Reflection »




Array
Constructor
Event
Field
Interface
Method
Properties
Type