Module.GetCustomAttributesData Module.GetCustomAttributesData Module.GetCustomAttributesData Module.GetCustomAttributesData Method

定义

返回当前模块的 CustomAttributeData 对象列表,这些对象可以在只反射上下文中使用。Returns a list of CustomAttributeData objects for the current module, which can be used in the reflection-only context.

public:
 virtual System::Collections::Generic::IList<System::Reflection::CustomAttributeData ^> ^ GetCustomAttributesData();
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributesData ();
abstract member GetCustomAttributesData : unit -> System.Collections.Generic.IList<System.Reflection.CustomAttributeData>
override this.GetCustomAttributesData : unit -> System.Collections.Generic.IList<System.Reflection.CustomAttributeData>
Public Overridable Function GetCustomAttributesData () As IList(Of CustomAttributeData)

返回

CustomAttributeData 对象的泛型列表,表示已应用到当前模块的特性的相关数据。A generic list of CustomAttributeData objects representing data about the attributes that have been applied to the current module.

注解

如果自定义属性本身是在加载到仅反射上下文中的代码中定义的,则使用此方法在仅反射上下文中检查代码的自定义属性。Use this method to examine the custom attributes of code in the reflection-only context, in cases where the custom attributes themselves are defined in code that is loaded into the reflection-only context. 在这种情况下,不能使用诸如 Attribute.GetCustomAttributes 和 @no__t 的方法,因为它们会创建属性的实例。Methods such as Attribute.GetCustomAttributes and Module.GetCustomAttributes cannot be used in such cases, because they create instances of the attributes. 仅反射上下文中的代码无法执行。Code in the reflection-only context cannot be executed. 有关详细信息和示例代码,请参阅 CustomAttributeData 类。For more information and example code, see the CustomAttributeData class.

适用于