SecurityElement.Attributes Propriedade

Definição

Obtém ou define os atributos de um elemento XML como pares nome/valor.

public:
 property System::Collections::Hashtable ^ Attributes { System::Collections::Hashtable ^ get(); void set(System::Collections::Hashtable ^ value); };
public System.Collections.Hashtable? Attributes { get; set; }
public System.Collections.Hashtable Attributes { get; set; }
member this.Attributes : System.Collections.Hashtable with get, set
Public Property Attributes As Hashtable

Valor da propriedade

Hashtable

O Hashtable objeto para os valores de atributo do elemento XML.

Exceções

O nome ou o valor do objeto Hashtable é inválido.

O nome não é um nome de atributo XML válido.

Exemplos

O código a seguir mostra o uso da Attributes propriedade para obter um atributo de um elemento XML. Este exemplo de código faz parte de um exemplo maior fornecido para a SecurityElement classe .

Hashtable^ attributeKeys = xmlElement->Attributes;
String^ attributeValue = attributeKeys[ attributeName ]->ToString();
Hashtable attributeKeys = xmlElement.Attributes;
string attributeValue = attributeKeys[attributeName].ToString();
Dim attributeKeys As Hashtable = xmlElement.Attributes
Dim attributeValue As String = attributeKeys(attributeName).ToString()

Comentários

Cada atributo é armazenado no Hashtable como um par nome/valor.

Nomes e valores em atributos devem conter apenas caracteres de atributo XML válidos. Use Escape para remover caracteres inválidos da cadeia de caracteres.

Não há suporte para cadeias de caracteres entre aspas, portanto, as cadeias de caracteres para pares de nome/valor não devem conter aspas ou outros caracteres que exigem aspas.

Aplica-se a