SecurityElement.Attribute(String) Metodo

Definizione

Trova un attributo in base al nome in un elemento 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

Parametri

name
String

Nome dell'attributo per il quale eseguire la ricerca.

Valori restituiti

Valore associato all'attributo denominato o null se non esiste alcun attributo.name

Eccezioni

Il name parametro è null.

Esempio

Il codice seguente illustra l'uso del Attribute metodo per trovare un attributo in base al nome. Questo esempio di codice fa parte di un esempio più ampio fornito per la SecurityElement classe .

string xmlCreationDate = xmlElement.Attribute("creationdate");
Dim xmlCreationDate As String = xmlElement.Attribute("creationdate")

Commenti

Con XML come indicato di seguito, Attribute("B") restituirebbe "456".

<thetag A="123" B="456" C="789">text</thetag>

Si applica a