Share via


Assembly.GetTypes Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the types defined in this assembly.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Overridable Function GetTypes As Type()
public virtual Type[] GetTypes()

Return Value

Type: array<System.Type[]
An array of type Type containing objects for all the types defined in this assembly.

Exceptions

Exception Condition
ReflectionTypeLoadException

The assembly contains one or more types that cannot be loaded. The array returned by the Types property of this exception contains a Type object for each type that was loaded and nulla null reference (Nothing in Visual Basic) for each type that could not be loaded, while the LoaderExceptions property contains an exception for each type that could not be loaded.

MemberAccessException

The method is invoked late-bound through mechanisms such as Type.InvokeMember.

Remarks

The returned array includes nested types.

If the 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 ReflectionTypeLoadException is thrown. For example, this can happen if the second assembly cannot be located when the GetTypes method is called.

NoteNote:

If a type has been forwarded to another assembly, it is not included in the returned array.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.