ParameterInfo.GetCustomAttributesData 方法

定义

返回当前参数的 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)

返回

IList<CustomAttributeData>

CustomAttributeData 对象的泛型列表,表示有关已应用于当前参数的特性的数据。

注解

如果自定义属性本身是在加载到仅反射上下文中的代码中定义的,则使用此方法在仅反射上下文中检查代码的自定义属性。 此 Attribute.GetCustomAttributes ParameterInfo.GetCustomAttributes 类情况下不能使用和等方法,因为它们会创建属性的实例。 仅反射上下文中的代码无法执行。 有关详细信息和示例代码,请参阅 CustomAttributeData 类。

适用于