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);
public string? Attribute (string name);
member this.Attribute : string -> string
Public Function Attribute (name As String) As String

Parametri

name
String

Nome dell'attributo da ricercare.

Restituisce

Il valore associato all'attributo denominato oppure null se non esiste alcun attributo con parametro name.

Eccezioni

Il valore del parametro name è null.

Esempio

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

String^ xmlCreationDate = xmlElement->Attribute(L"creationdate");
string xmlCreationDate = xmlElement.Attribute("creationdate");
Dim xmlCreationDate As String = xmlElement.Attribute("creationdate")

Commenti

Con XML come segue, Attribute("B") restituirebbe "456".

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

Si applica a