SecurityElement::Attribute Method (String^)
.NET Framework (current version)
Finds an attribute by name in an XML element.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- name
-
Type:
System::String^
The name of the attribute for which to search.
Return Value
Type: System::String^The value associated with the named attribute, or null if no attribute with name exists.
| Exception | Condition |
|---|---|
| ArgumentNullException | The name parameter is null. |
With XML as follows, Attribute("B") would return "456".
<thetag A="123" B="456" C="789">text</thetag>
The following code shows the use of the Attribute method to find an attribute by name. This code example is part of a larger example provided for the SecurityElement class.
.NET Framework
Available since 1.1
Available since 1.1
Show: