List a program’s loaded assemblies in C#


The key to this example is the following ListAssemblies method.

// List the assemblies.
private void ListAssemblies()
    lblNumAssemblies.Text = "";
    Cursor = Cursors.WaitCursor;

    foreach (Assembly assembly in

    // Display the number of assemblies.
    lblNumAssemblies.Text =
        lstAssemblies.Items.Count.ToString() + " assemblies";
    Cursor = Cursors.Default;

To list the assemblies that the program has loaded, the code calls AppDomain.CurrentDomain.GetAssemblies and loops over the Assembly objects that it returns. The program calls each object’s GetName method to get an AssemblyName object for it. It displays the value of that object’s Name property in the list box.

Download Example   Follow me on Twitter   RSS feed   Donate

This entry was posted in classes, reflection and tagged , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.