_MethodInfo.GetCustomAttributes Metod

Definition

Tillhandahåller COM-objekt med versionsoberoende åtkomst till GetCustomAttributes metoderna.

Överlagringar

Name Description
GetCustomAttributes(Boolean)

Tillhandahåller COM-objekt med versionsoberoende åtkomst till GetCustomAttributes(Boolean) metoden.

GetCustomAttributes(Type, Boolean)

Tillhandahåller COM-objekt med versionsoberoende åtkomst till GetCustomAttributes(Type, Boolean) metoden.

Kommentarer

Den här metoden är för åtkomst till hanterade klasser från ohanterad kod och bör inte anropas från hanterad kod.

Medlemmarna GetCustomAttributes returnerar alla attribut som tillämpas på den här medlemmen.

GetCustomAttributes(Boolean)

Tillhandahåller COM-objekt med versionsoberoende åtkomst till GetCustomAttributes(Boolean) metoden.

public:
 cli::array <System::Object ^> ^ GetCustomAttributes(bool inherit);
public object[] GetCustomAttributes(bool inherit);
abstract member GetCustomAttributes : bool -> obj[]
Public Function GetCustomAttributes (inherit As Boolean) As Object()

Parametrar

inherit
Boolean

trueför att söka i den här medlemmens arvskedja för att hitta attributen; annars . false

Returer

Object[]

En matris som innehåller alla anpassade attribut eller en matris med noll (0) element om inga attribut har definierats.

Kommentarer

Den här metoden är för åtkomst till hanterade klasser från ohanterad kod och bör inte anropas från hanterad kod.

Metoden GetCustomAttributes returnerar en matris som innehåller alla anpassade attribut.

Gäller för

GetCustomAttributes(Type, Boolean)

Tillhandahåller COM-objekt med versionsoberoende åtkomst till GetCustomAttributes(Type, Boolean) metoden.

public:
 cli::array <System::Object ^> ^ GetCustomAttributes(Type ^ attributeType, bool inherit);
public object[] GetCustomAttributes(Type attributeType, bool inherit);
abstract member GetCustomAttributes : Type * bool -> obj[]
Public Function GetCustomAttributes (attributeType As Type, inherit As Boolean) As Object()

Parametrar

attributeType
Type

Typ av attribut att söka efter. Endast attribut som kan tilldelas den här typen returneras.

inherit
Boolean

trueför att söka i den här medlemmens arvskedja för att hitta attributen; annars . false

Returer

Object[]

En matris med anpassade attribut som tillämpas på den här medlemmen eller en matris med noll (0) element om inga attribut har tillämpats.

Kommentarer

Den här metoden är för åtkomst till hanterade klasser från ohanterad kod och bör inte anropas från hanterad kod.

Metoden GetCustomAttributes returnerar en matris med anpassade attribut som identifieras av Type.

Gäller för