System.Reflection.Assembly.GetTypes Method

Gets the types defined in this assembly.

Syntax

public virtual Type[] GetTypes ()

Returns

An array that contains all the types that are defined in this assembly.

Remarks

The returned array includes nested types.

If the Assembly.GetTypes method is called on an assembly and a type in that assembly is dependent on a type in an assembly that has not been loaded (for example, if it derives from a type in the second assembly), a System.Reflection.ReflectionTypeLoadException is thrown. For example, this can happen if the first assembly was loaded with the Assembly.ReflectionOnlyLoad(string) or Assembly.ReflectionOnlyLoadFrom(string) methods, and the second assembly was not loaded. It can also happen with assemblies loaded using the Assembly.Load(string) and Assembly.LoadFile(string) methods if the second assembly cannot be located when the Assembly.GetTypes method is called.

Note:

If a type has been forwarded to another assembly, it is not included in the returned array. For information on type forwarding, see Type Forwarding in the Common Language Runtime.

Requirements

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0