Module.GetCustomAttributesData 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回当前模块的对象列表,该列表 CustomAttributeData 可用于仅反射上下文。
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 。
注解
使用此方法在仅反射上下文中检查代码的自定义属性,以防自定义属性本身在加载到仅反射上下文的代码中定义。 此类方法(例如 Attribute.GetCustomAttributes 和 Module.GetCustomAttributes 不能在此类情况下使用),因为它们会创建属性的实例。 无法执行仅反射上下文中的代码。 有关详细信息和示例代码,请参阅该 CustomAttributeData 类。