Tuesday, March 23, 2004

What assemblies are running?

Reflection is the process of interrogating an assembly at run time to discover information about the various types that an assembly contains. There are actually all sorts of information that can be retrieved using Reflection. I was doing some coding with a customer and needed to check what assemblies were currently loaded into the application. The System namespace provides the AppDomain class that can be used to return a reference to the current application domain. The calling the GetAssemblies method this can be used to return a list of currently executing assemblies.

 

First, make sure that you import the Reflection class.

Imports System.Reflection

 

Then the following code is used to list the current loaded assemblies

Dim lasm As [Assembly]

For Each lasm In AppDomain.CurrentDomain.GetAssemblies

MsgBox(lasm.GetName.ToString)

Next

 


10:53:59 PM    
comment [] trackback []