SecurityElement.Attribute(String) 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.
Recherche un attribut par nom dans un élément XML.
public:
System::String ^ Attribute(System::String ^ name);
public string Attribute(string name);
member this.Attribute : string -> string
Public Function Attribute (name As String) As String
Paramètres
- name
- String
Nom de l’attribut pour lequel effectuer la recherche.
Retours
Valeur associée à l’attribut nommé, ou null si aucun attribut name n’existe.
Exceptions
Le name paramètre est null.
Exemples
Le code suivant montre l’utilisation de la Attribute méthode pour rechercher un attribut par nom. Cet exemple de code fait partie d’un exemple plus grand fourni pour la SecurityElement classe.
string xmlCreationDate = xmlElement.Attribute("creationdate");
Dim xmlCreationDate As String = xmlElement.Attribute("creationdate")
Remarques
Avec XML comme suit, Attribute("B") retourne « 456 ».
<thetag A="123" B="456" C="789">text</thetag>