Share via


SecurityElement.Attributes Propiedad

Definición

Obtiene o establece los atributos de un elemento XML como pares nombre/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 de propiedad

Objeto Hashtable de los valores de atributo del elemento XML.

Excepciones

El nombre o valor del objeto Hashtable no es válido.

El nombre no es un nombre del atributo XML válido.

Ejemplos

En el código siguiente se muestra el uso de la Attributes propiedad para obtener un atributo de un elemento XML. Este ejemplo de código es parte de un ejemplo mayor proporcionado para la clase SecurityElement.

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()

Comentarios

Cada atributo se almacena en Hashtable como un par nombre/valor.

Los nombres y los valores de los atributos deben contener solo caracteres de atributo XML válidos. Use Escape para quitar caracteres no válidos de la cadena.

No se admiten cadenas entre comillas, por lo que las cadenas de pares nombre-valor no deben contener comillas u otros caracteres que requieran comillas.

Se aplica a