ICustomAttributeProvider.GetCustomAttributes Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Retourne les attributs personnalisés définis sur ce membre.
Surcharges
GetCustomAttributes(Boolean) |
Retourne un tableau de tous les attributs personnalisés définis sur ce membre, en dehors des attributs nommés, ou un tableau vide s’il n’y a aucun attribut personnalisé. |
GetCustomAttributes(Type, Boolean) |
Retourne un tableau d’attributs personnalisés définis sur ce membre, identifiés par type, ou un tableau vide s’il n’y a aucun attribut personnalisé de ce type. |
GetCustomAttributes(Boolean)
Retourne un tableau de tous les attributs personnalisés définis sur ce membre, en dehors des attributs nommés, ou un tableau vide s’il n’y a aucun attribut personnalisé.
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()
Paramètres
- inherit
- Boolean
Si true
, recherchez la chaîne de hiérarchie pour l’attribut personnalisé hérité.
Retours
- Object[]
Un tableau d’objets représentant des attributs personnalisés ou un tableau vide.
Exceptions
Le type d’attribut personnalisé ne peut pas être chargé.
Il existe plusieurs attributs de type attributeType
définis sur ce membre.
Remarques
L’appel ICustomAttributeProvider.GetCustomAttributes ou EventInfo lorsque le inherit
paramètre d’un GetCustomAttributes
objet true
n’effectue pas la procédure de la hiérarchie de PropertyInfo type. Permet d’hériter System.Attribute d’attributs personnalisés.
Cette méthode retourne des attributs personnalisés définis directement sur un membre non hérité uniquement.
S’applique à
GetCustomAttributes(Type, Boolean)
Retourne un tableau d’attributs personnalisés définis sur ce membre, identifiés par type, ou un tableau vide s’il n’y a aucun attribut personnalisé de ce type.
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()
Paramètres
- attributeType
- Type
Type des attributs personnalisés.
- inherit
- Boolean
Si true
, recherchez la chaîne de hiérarchie pour l’attribut personnalisé hérité.
Retours
- Object[]
Un tableau d’objets représentant des attributs personnalisés ou un tableau vide.
Exceptions
Le type d’attribut personnalisé ne peut pas être chargé.
attributeType
a la valeur null
.
Remarques
S’il s’agit attributeType
d’une classe de base ou d’une interface, cette méthode retourne toute implémentation de ce type.
Cette méthode retourne des attributs personnalisés définis directement sur un membre non hérité uniquement.
L’appel ICustomAttributeProvider.GetCustomAttributes ou EventInfo lorsque le inherit
paramètre d’un GetCustomAttributes
objet true
n’effectue pas la procédure de la hiérarchie de PropertyInfo type. Permet d’hériter System.Attribute d’attributs personnalisés.