O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Examine an Assembly for Types

Problem

You want to display all the types in an assembly.

Solution

Use the Assembly.GetTypes method.

Discussion

The Assembly.GetTypes method returns an array of Type objects that represent all the classes, interfaces, enumerations, and other types defined in an assembly. You can use this method in conjunction with the methods of the Type class (shown in recipe Examine a Type for Members) to "walk" the structure of an assembly.

The following example demonstrates a simple knock-off of the IL disassembler (ILDASM) included with the .NET Framework SDK. It’s a Windows application that allows the user to choose an assembly file and then displays a hierarchical tree that shows all the types it contains. Figure 9-1 shows the test ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required