Redigeeri

Jagamisviis:


SecurityElement.Attributes Property

Definition

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

Property Value

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

Exceptions

The name or value of the Hashtable object is invalid.

The name is not a valid XML attribute name.

Examples

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();
Hashtable attributeKeys = xmlElement.Attributes;
string attributeValue = attributeKeys[attributeName].ToString();
Dim attributeKeys As Hashtable = xmlElement.Attributes
Dim attributeValue As String = attributeKeys(attributeName).ToString()

Remarks

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.

Applies to