SecurityElement.Attributes Propriedade
Definição
Obtém ou define os atributos de um elemento XML como pares nome/valor.Gets or sets the attributes of an XML element as name/value pairs.
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
O Hashtable objeto para os valores de atributo do elemento XML.The Hashtable object for the attribute values of the XML element.
Exceções
O nome ou o valor do objeto Hashtable é inválido.The name or value of the Hashtable object is invalid.
O nome não é um nome de atributo XML válido.The name is not a valid XML attribute name.
Exemplos
O código a seguir mostra o uso da Attributes propriedade para obter um atributo de um elemento XML.The following code shows the use of the Attributes property to get an attribute of an XML element. Este exemplo de código faz parte de um exemplo maior fornecido para a SecurityElement classe.This code example is part of a larger example provided for the SecurityElement class.
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 de nome/valor.Each attribute is stored in the Hashtable as a name/value pair.
Os nomes e valores em atributos devem conter apenas caracteres de atributo XML válidos.Names and values in attributes should contain only valid XML attribute characters. Use Escape para remover caracteres inválidos da cadeia de caracteres.Use Escape to remove invalid characters from the string.
Não há suporte para cadeias de caracteres entre aspas, portanto, cadeias de caracteres para pares de nome/valor não devem conter aspas ou outro caractere que exija a cotação.There is no support for quoted strings, so strings for name/value pairs should not contain quotes or other characters requiring quoting.