Examine a Type for Members

Problem

You want to retrieve information about the properties, events, methods, and other members exposed by a type.

Solution

Use methods such as Type.GetMethods, Type.GetProperties, Type.GetEvents, and so on.

Discussion

The Type class is a starting point for a detailed examination of any .NET type. You can use the following methods to delve into the structure of a type:

  • GetConstructors. retrieves an array of ConstructorInfo objects, which detail the constructors for a type.

  • GetMethods. retrieves an array of MethodInfo objects, which describe the functions and subroutines provided by a type.

  • GetProperties. retrieves an array of PropertyInfo objects, which describe the properties for a type.

  • GetEvents. retrieves an array of

Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.