SecurityElement.Attributes Property


Gets or sets the attributes of an XML element as name/value pairs.

Namespace:   System.Security
Assembly:  mscorlib (in mscorlib.dll)

public Hashtable Attributes { get; set; }

Property Value

Type: System.Collections.Hashtable

The Hashtable object for the attribute values of the XML element.

Exception Condition

The name or value of the Hashtable object is invalid.


The name is not a valid XML attribute name.

Each attribute is stored in the Hashtable as a name/value pair.

Names and values in attributes should contain only valid XML attribute characters. Use Escape to remove invalid characters from the string.

There is no support for quoted strings, so strings for name/value pairs should not contain quotes or other characters requiring quoting.

The following code shows the use of the Attributes property to get an attribute of an XML element. This code example is part of a larger example provided for the SecurityElement class.

Hashtable attributeKeys = xmlElement.Attributes;
string attributeValue = attributeKeys[attributeName].ToString();

.NET Framework
Available since 1.1
Return to top