Module.GetCustomAttributesData Method

Definition

Returns a list of CustomAttributeData objects for the current module, which can be used in the reflection-only context.

C#
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributesData();

Returns

A generic list of CustomAttributeData objects representing data about the attributes that have been applied to the current module.

Remarks

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. 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. For more information and example code, see the CustomAttributeData class.

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1