SecurityElement.Attribute(String) Método

Definição

Localiza um atributo pelo nome em um 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

Parâmetros

name
String

O nome do atributo pelo qual pesquisar.

Retornos

O valor associado ao atributo nomeado ou null se nenhum atributo com name existir.

Exceções

O parâmetro name é null.

Exemplos

O código a seguir mostra o uso do Attribute método para localizar um atributo por nome. Este exemplo de código faz parte de um exemplo maior fornecido para a SecurityElement classe .

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

Comentários

Com XML da seguinte maneira, Attribute("B") retornaria "456".

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

Aplica-se a