CONSOLE APPLICATION : VBReflection Project Overview


Reflection provides objects (of type Type) that encapsulate assemblies,
modules and types. It allows us to

1. Access attributes in your program's metadata.
2. Examine and instantiate types in an assembly.
3. Dynamically load and use types.
4. Emit new types at runtime.

This sample demonstrates 2 and 3.

Project Relation:

VBReflection -> VBClassLibrary
VBReflection dynamically loads the assembly, VBClassLibrary.dll, and
instantiate, examine and use its types.


1. Dynamically load the assembly.
(Assembly.LoadFrom, Assembly.Load, Assembly.LoadFile)

2. Get a type and instantiate the type in the assembly.
(Assembly.GetType, Activator.CreateInstance, Assembly.CreateInstance)

3. Examine the type. (Type.GetFields, Type.GetProperties, Type.GetEvents,
Type.GetMethods, Type.GetConstructors)

4. Use the type (Late Binding). (MethodInfo.Invoke)

5. There is no API to unload an assembly


Reflection in Visual Basic .NET

Dynamically Loading and Using Types

How to: Hook Up a Delegate Using Reflection