Module.GetTypes 方法


返回在此模块中定义的所有类型。Returns all the types defined within this module.

 virtual cli::array <Type ^> ^ GetTypes();
public virtual Type[] GetTypes ();
abstract member GetTypes : unit -> Type[]
override this.GetTypes : unit -> Type[]
Public Overridable Function GetTypes () As Type()



一组 Type 类型,其中包含在此实例反映的模块中定义的类型。An array of type Type containing types defined within the module that is reflected by this instance.


无法加载模块中的一个或多个类。One or more classes in a module could not be loaded.

调用方没有所要求的权限。The caller does not have the required permission.


ReflectionTypeLoadException 是一种特殊的负载异常。ReflectionTypeLoadException is a special load exception. ReflectionTypeLoadException.Types 属性包含已在模块中定义并加载的类型的数组。The ReflectionTypeLoadException.Types property contains the array of types that were defined in the module and were loaded. 此数组可能包含一些 null 值。This array may contain some null values. ReflectionTypeLoadException.LoaderExceptions 属性是异常的数组,表示加载程序引发的异常。The ReflectionTypeLoadException.LoaderExceptions property is an array of exceptions that represent the exceptions that were thrown by the loader. 类数组中的孔与异常一起排列。The holes in the class array line up with the exceptions.

例如,如果某个类的类初始值设定项在加载时引发了异常,则 TargetInvocationException 存储在 LoaderExceptions 数组的相应元素中。For example, if the class initializers of one of the classes throws an exception while it is being loaded, a TargetInvocationException is stored in the corresponding element of the LoaderExceptions array.


如果类型已转发给另一个程序集,则它不会包含在返回的数组中。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.