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);
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 à rechercher.
Retours
Valeur associée à l'attribut nommé, ou null
s'il n'existe aucun attribut avec name
.
Exceptions
Le paramètre name
a la valeur 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(L"creationdate");
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>
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de l’année 2024, nous abandonnerons progressivement le mécanisme de retour d’information GitHub Issues pour le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultez :Soumettre et afficher des commentaires pour