Share via


SecurityElement.Attribute(String) Méthode

Définition

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 à