3.10. Retrieve Type Information

Problem

You need to obtain a System.Type object that represents a specific type.

Solution

Use one of the following:

  • The GetType operator

  • The Shared GetType method of the System.Type class

  • The Object.GetType method of an existing instance of the type

  • The GetNestedType or GetNestedTypes method of the Type class

  • The GetType or GetTypes method of the Assembly class

  • The GetType, GetTypes, or FindTypes method of the System.Reflection.Module class

How It Works

The Type class provides a starting point for working with types using reflection. A Type object allows you to inspect the metadata of the type, obtain details of the type's members, and create instances of the type. Because of the type's importance, the .NET Framework ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach 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.